My Project
Loading...
Searching...
No Matches
Public Member Functions | Properties | List of all members
WebSocketSharp.Server.WebSocketServiceManager Class Reference

Provides the management function for the WebSocket services. More...

Public Member Functions

void AddService< TBehavior > (string path, Action< TBehavior > initializer)
 Adds a WebSocket service with the specified behavior, path, and delegate.
 
void Clear ()
 Removes all WebSocket services managed by the manager.
 
bool RemoveService (string path)
 Removes a WebSocket service with the specified path.
 
bool TryGetServiceHost (string path, out WebSocketServiceHost host)
 Tries to get the service host instance for a WebSocket service with the specified path.
 

Properties

int Count [get]
 Gets the number of the WebSocket services.
 
IEnumerable< WebSocketServiceHost > Hosts [get]
 Gets the service host instances for the WebSocket services.
 
WebSocketServiceHost this[string path] [get]
 Gets the service host instance for a WebSocket service with the specified path.
 
bool KeepClean [get, set]
 Gets or sets a value indicating whether the inactive sessions in the WebSocket services are cleaned up periodically.
 
IEnumerable< string > Paths [get]
 Gets the paths for the WebSocket services.
 
TimeSpan WaitTime [get, set]
 Gets or sets the time to wait for the response to the WebSocket Ping or Close.
 

Detailed Description

Provides the management function for the WebSocket services.

This class manages the WebSocket services provided by the WebSocketServer or HttpServer class.

Member Function Documentation

◆ AddService< TBehavior >()

void WebSocketSharp.Server.WebSocketServiceManager.AddService< TBehavior > ( string  path,
Action< TBehavior >  initializer 
)
inline

Adds a WebSocket service with the specified behavior, path, and delegate.

Parameters
pathA string that specifies an absolute path to the service to add. / is trimmed from the end of the string if present.
initializerAn Action<TBehavior> delegate or null if not needed. The delegate invokes the method called when initializing a new session instance for the service.
Template Parameters
TBehaviorThe type of the behavior for the service. It must inherit the WebSocketBehavior class. And also, it must have a public parameterless constructor.
Exceptions
ArgumentNullExceptionpath is null.
ArgumentExceptionpath is an empty string. -or- path is not an absolute path. -or- path includes either or both query and fragment components. -or- path is already in use.
Type Constraints
TBehavior :WebSocketBehavior 
TBehavior :new 

◆ Clear()

void WebSocketSharp.Server.WebSocketServiceManager.Clear ( )
inline

Removes all WebSocket services managed by the manager.

A service is stopped with close status 1001 (going away) if it has already started.

◆ RemoveService()

bool WebSocketSharp.Server.WebSocketServiceManager.RemoveService ( string  path)
inline

Removes a WebSocket service with the specified path.

The service is stopped with close status 1001 (going away) if it has already started.

Returns
true if the service is successfully found and removed; otherwise, false.
Parameters
pathA string that specifies an absolute path to the service to remove. / is trimmed from the end of the string if present.
Exceptions
ArgumentNullExceptionpath is null.
ArgumentExceptionpath is an empty string. -or- path is not an absolute path. -or- path includes either or both query and fragment components.

◆ TryGetServiceHost()

bool WebSocketSharp.Server.WebSocketServiceManager.TryGetServiceHost ( string  path,
out WebSocketServiceHost  host 
)
inline

Tries to get the service host instance for a WebSocket service with the specified path.

Returns
true if the service is successfully found; otherwise, false.
Parameters
pathA string that specifies an absolute path to the service to find. / is trimmed from the end of the string if present.
hostWhen this method returns, a WebSocketServiceHost instance or null if not found. The service host instance provides the function to access the information in the service.
Exceptions
ArgumentNullExceptionpath is null.
ArgumentExceptionpath is an empty string. -or- path is not an absolute path. -or- path includes either or both query and fragment components.

Property Documentation

◆ Count

int WebSocketSharp.Server.WebSocketServiceManager.Count
get

Gets the number of the WebSocket services.

An int that represents the number of the services.

◆ Hosts

IEnumerable<WebSocketServiceHost> WebSocketSharp.Server.WebSocketServiceManager.Hosts
get

Gets the service host instances for the WebSocket services.

An IEnumerable<WebSocketServiceHost> instance.

It provides an enumerator which supports the iteration over the collection of the service host instances.

◆ KeepClean

bool WebSocketSharp.Server.WebSocketServiceManager.KeepClean
getset

Gets or sets a value indicating whether the inactive sessions in the WebSocket services are cleaned up periodically.

The set operation does nothing if the server has already started or it is shutting down.

true if the inactive sessions are cleaned up every 60 seconds; otherwise, false.

The default value is true.

◆ Paths

IEnumerable<string> WebSocketSharp.Server.WebSocketServiceManager.Paths
get

Gets the paths for the WebSocket services.

An IEnumerable<string> instance.

It provides an enumerator which supports the iteration over the collection of the paths.

◆ this[string path]

WebSocketServiceHost WebSocketSharp.Server.WebSocketServiceManager.this[string path]
get

Gets the service host instance for a WebSocket service with the specified path.

A WebSocketServiceHost instance or null if not found.

The service host instance provides the function to access the information in the service.

Parameters
pathA string that specifies an absolute path to the service to find. / is trimmed from the end of the string if present.
Exceptions
ArgumentNullExceptionpath is null.
ArgumentExceptionpath is an empty string. -or- path is not an absolute path. -or- path includes either or both query and fragment components.

◆ WaitTime

TimeSpan WebSocketSharp.Server.WebSocketServiceManager.WaitTime
getset

Gets or sets the time to wait for the response to the WebSocket Ping or Close.

The set operation does nothing if the server has already started or it is shutting down.

A TimeSpan to wait for the response.

The default value is the same as 1 second.

Exceptions
ArgumentOutOfRangeExceptionThe value specified for a set operation is zero or less.

The documentation for this class was generated from the following file: