C# Class WebSocketSharp.Server.WebSocketServiceHostManager

Manages the WebSocket services provided by the HttpServer and WebSocketServer.
Datei anzeigen Open project: uken/websocket-sharp Class Usage Examples

Public Methods

Method Description
Broadcast ( byte data ) : void

Broadcasts a binary data to all clients of the WebSocket services provided by the server.

Broadcast ( string data ) : void

Broadcasts a text data to all clients of the WebSocket services provided by the server.

BroadcastAsync ( System.Stream stream, int length, System.Action completed ) : void

Broadcasts a binary data from the specified Stream asynchronously to all clients of the WebSocket services provided by the server.

This method doesn't wait for the broadcast to be complete.

BroadcastAsync ( byte data, System.Action completed ) : void

Broadcasts a binary data asynchronously to all clients of the WebSocket services provided by the server.

This method doesn't wait for the broadcast to be complete.

BroadcastAsync ( string data, System.Action completed ) : void

Broadcasts a text data asynchronously to all clients of the WebSocket services provided by the server.

This method doesn't wait for the broadcast to be complete.

BroadcastTo ( string servicePath, byte data ) : void

Broadcasts a binary data to all clients of the WebSocket service with the specified servicePath.

BroadcastTo ( string servicePath, string data ) : void

Broadcasts a text data to all clients of the WebSocket service with the specified servicePath.

BroadcastToAsync ( string servicePath, System.Stream stream, int length, System.Action completed ) : void

Broadcasts a binary data from the specified Stream asynchronously to all clients of the WebSocket service with the specified servicePath.

This method doesn't wait for the broadcast to be complete.

BroadcastToAsync ( string servicePath, byte data, System.Action completed ) : void

Broadcasts a binary data asynchronously to all clients of the WebSocket service with the specified servicePath.

This method doesn't wait for the broadcast to be complete.

BroadcastToAsync ( string servicePath, string data, System.Action completed ) : void

Broadcasts a text data asynchronously to all clients of the WebSocket service with the specified servicePath.

This method doesn't wait for the broadcast to be complete.

Broadping ( ) : Dictionary>

Sends Pings to all clients of the WebSocket services provided by the server.

Broadping ( string message ) : Dictionary>

Sends Pings with the specified message to all clients of the WebSocket services provided by the server.

BroadpingTo ( string servicePath ) : bool>.Dictionary

Sends Pings to all clients of the WebSocket service with the specified servicePath.

BroadpingTo ( string servicePath, string message ) : bool>.Dictionary

Sends Pings with the specified message to all clients of the WebSocket service with the specified servicePath.

CloseSession ( string servicePath, string id ) : void

Closes the session with the specified servicePath and id.

CloseSession ( string servicePath, string id, CloseStatusCode code, string reason ) : void

Closes the session with the specified servicePath, id, code and reason.

CloseSession ( string servicePath, string id, ushort code, string reason ) : void

Closes the session with the specified servicePath, id, code and reason.

PingTo ( string servicePath, string id ) : bool

Sends a Ping to the client associated with the specified servicePath and id.

PingTo ( string servicePath, string id, string message ) : bool

Sends a Ping with the specified message to the client associated with the specified servicePath and id.

SendTo ( string servicePath, string id, byte data ) : void

Sends a binary data to the client on the session with the specified id, in the WebSocket service with the specified servicePath.

SendTo ( string servicePath, string id, string data ) : void

Sends a text data to the client on the session with the specified id, in the WebSocket service with the specified servicePath.

SendToAsync ( string servicePath, string id, System.Stream stream, int length, Action completed ) : void

Sends a binary data from the specified Stream asynchronously to the client on the session with the specified id, in the WebSocket service with the specified servicePath.

This method doesn't wait for the send to be complete.

SendToAsync ( string servicePath, string id, byte data, Action completed ) : void

Sends a binary data asynchronously to the client on the session with the specified id, in the WebSocket service with the specified servicePath.

This method doesn't wait for the send to be complete.

SendToAsync ( string servicePath, string id, string data, Action completed ) : void

Sends a text data asynchronously to the client on the session with the specified id, in the WebSocket service with the specified servicePath.

This method doesn't wait for the send to be complete.

TryGetServiceHost ( string servicePath, WebSocketSharp.Server.WebSocketServiceHost &serviceHost ) : bool

Tries to get a WebSocket service host with the specified servicePath.

this ( string servicePath ) : WebSocketSharp.Server.WebSocketServiceHost

Gets a WebSocket service host with the specified servicePath.

Private Methods

Method Description
Add ( string servicePath, WebSocketSharp.Server.WebSocketServiceHost serviceHost ) : void
Remove ( string servicePath ) : bool
Start ( ) : void
Stop ( byte data, bool send ) : void
TryGetServiceHostInternally ( string servicePath, WebSocketSharp.Server.WebSocketServiceHost &serviceHost ) : bool
WebSocketServiceHostManager ( ) : System
WebSocketServiceHostManager ( System.Logger logger ) : System
broadcast ( Opcode opcode, System.Stream stream, System.Action completed ) : void
broadcast ( Opcode opcode, byte data, System.Action completed ) : void
broadcastAsync ( Opcode opcode, System.Stream stream, System.Action completed ) : void
broadcastAsync ( Opcode opcode, byte data, System.Action completed ) : void
broadping ( byte frameAsBytes, int timeOut ) : Dictionary>
checkIfCanSend ( Func checkParams ) : string

Method Details

Broadcast() public method

Broadcasts a binary data to all clients of the WebSocket services provided by the server.
public Broadcast ( byte data ) : void
data byte /// An array of that represents the binary data /// to broadcast. ///
return void

Broadcast() public method

Broadcasts a text data to all clients of the WebSocket services provided by the server.
public Broadcast ( string data ) : void
data string /// A that represents the text data to broadcast. ///
return void

BroadcastAsync() public method

Broadcasts a binary data from the specified Stream asynchronously to all clients of the WebSocket services provided by the server.
This method doesn't wait for the broadcast to be complete.
public BroadcastAsync ( System.Stream stream, int length, System.Action completed ) : void
stream System.Stream /// A from which contains the binary data to broadcast. ///
length int /// An that represents the number of bytes to broadcast. ///
completed System.Action /// A delegate that references the method(s) called when /// the broadcast is complete. ///
return void

BroadcastAsync() public method

Broadcasts a binary data asynchronously to all clients of the WebSocket services provided by the server.
This method doesn't wait for the broadcast to be complete.
public BroadcastAsync ( byte data, System.Action completed ) : void
data byte /// An array of that represents the binary data /// to broadcast. ///
completed System.Action /// A delegate that references the method(s) called when /// the broadcast is complete. ///
return void

BroadcastAsync() public method

Broadcasts a text data asynchronously to all clients of the WebSocket services provided by the server.
This method doesn't wait for the broadcast to be complete.
public BroadcastAsync ( string data, System.Action completed ) : void
data string /// A that represents the text data to broadcast. ///
completed System.Action /// A delegate that references the method(s) called when /// the broadcast is complete. ///
return void

BroadcastTo() public method

Broadcasts a binary data to all clients of the WebSocket service with the specified servicePath.
public BroadcastTo ( string servicePath, byte data ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
data byte /// An array of that represents the binary data /// to broadcast. ///
return void

BroadcastTo() public method

Broadcasts a text data to all clients of the WebSocket service with the specified servicePath.
public BroadcastTo ( string servicePath, string data ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
data string /// A that represents the text data to broadcast. ///
return void

BroadcastToAsync() public method

Broadcasts a binary data from the specified Stream asynchronously to all clients of the WebSocket service with the specified servicePath.
This method doesn't wait for the broadcast to be complete.
public BroadcastToAsync ( string servicePath, System.Stream stream, int length, System.Action completed ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
stream System.Stream /// A from which contains the binary data to broadcast. ///
length int /// An that represents the number of bytes to broadcast. ///
completed System.Action /// A delegate that references the method(s) called when /// the broadcast is complete. ///
return void

BroadcastToAsync() public method

Broadcasts a binary data asynchronously to all clients of the WebSocket service with the specified servicePath.
This method doesn't wait for the broadcast to be complete.
public BroadcastToAsync ( string servicePath, byte data, System.Action completed ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
data byte /// An array of that represents the binary data /// to broadcast. ///
completed System.Action /// A delegate that references the method(s) called when /// the broadcast is complete. ///
return void

BroadcastToAsync() public method

Broadcasts a text data asynchronously to all clients of the WebSocket service with the specified servicePath.
This method doesn't wait for the broadcast to be complete.
public BroadcastToAsync ( string servicePath, string data, System.Action completed ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
data string /// A that represents the text data to broadcast. ///
completed System.Action /// A delegate that references the method(s) called when /// the broadcast is complete. ///
return void

Broadping() public method

Sends Pings to all clients of the WebSocket services provided by the server.
public Broadping ( ) : Dictionary>
return Dictionary>

Broadping() public method

Sends Pings with the specified message to all clients of the WebSocket services provided by the server.
public Broadping ( string message ) : Dictionary>
message string /// A that represents the message to broadcast. ///
return Dictionary>

BroadpingTo() public method

Sends Pings to all clients of the WebSocket service with the specified servicePath.
public BroadpingTo ( string servicePath ) : bool>.Dictionary
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
return bool>.Dictionary

BroadpingTo() public method

Sends Pings with the specified message to all clients of the WebSocket service with the specified servicePath.
public BroadpingTo ( string servicePath, string message ) : bool>.Dictionary
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
message string /// A that represents the message to send. ///
return bool>.Dictionary

CloseSession() public method

Closes the session with the specified servicePath and id.
public CloseSession ( string servicePath, string id ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
id string /// A that represents the ID of the session to close. ///
return void

CloseSession() public method

Closes the session with the specified servicePath, id, code and reason.
public CloseSession ( string servicePath, string id, CloseStatusCode code, string reason ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
id string /// A that represents the ID of the session to close. ///
code CloseStatusCode /// One of the values that indicate the status /// codes for closure. ///
reason string /// A that represents the reason for closure. ///
return void

CloseSession() public method

Closes the session with the specified servicePath, id, code and reason.
public CloseSession ( string servicePath, string id, ushort code, string reason ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
id string /// A that represents the ID of the session to close. ///
code ushort /// A that represents the status code for closure. ///
reason string /// A that represents the reason for closure. ///
return void

PingTo() public method

Sends a Ping to the client associated with the specified servicePath and id.
public PingTo ( string servicePath, string id ) : bool
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
id string /// A that represents the ID of the session to send the /// Ping to. ///
return bool

PingTo() public method

Sends a Ping with the specified message to the client associated with the specified servicePath and id.
public PingTo ( string servicePath, string id, string message ) : bool
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
id string /// A that represents the ID of the session to send the /// Ping to. ///
message string /// A that represents the message to send. ///
return bool

SendTo() public method

Sends a binary data to the client on the session with the specified id, in the WebSocket service with the specified servicePath.
public SendTo ( string servicePath, string id, byte data ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
id string /// A that represents the ID of the session to find. ///
data byte /// An array of that represents the binary data to send. ///
return void

SendTo() public method

Sends a text data to the client on the session with the specified id, in the WebSocket service with the specified servicePath.
public SendTo ( string servicePath, string id, string data ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
id string /// A that represents the ID of the session to find. ///
data string /// A that represents the text data to send. ///
return void

SendToAsync() public method

Sends a binary data from the specified Stream asynchronously to the client on the session with the specified id, in the WebSocket service with the specified servicePath.
This method doesn't wait for the send to be complete.
public SendToAsync ( string servicePath, string id, System.Stream stream, int length, Action completed ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
id string /// A that represents the ID of the session to find. ///
stream System.Stream /// A from which contains the binary data to send. ///
length int /// An that represents the number of bytes to send. ///
completed Action /// An Action<bool> delegate that references the method(s) called when /// the send is complete. /// A passed to this delegate is true if the send is /// complete successfully; otherwise, false. ///
return void

SendToAsync() public method

Sends a binary data asynchronously to the client on the session with the specified id, in the WebSocket service with the specified servicePath.
This method doesn't wait for the send to be complete.
public SendToAsync ( string servicePath, string id, byte data, Action completed ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
id string /// A that represents the ID of the session to find. ///
data byte /// An array of that represents the binary data to send. ///
completed Action /// An Action<bool> delegate that references the method(s) called when /// the send is complete. /// A passed to this delegate is true if the send is /// complete successfully; otherwise, false. ///
return void

SendToAsync() public method

Sends a text data asynchronously to the client on the session with the specified id, in the WebSocket service with the specified servicePath.
This method doesn't wait for the send to be complete.
public SendToAsync ( string servicePath, string id, string data, Action completed ) : void
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
id string /// A that represents the ID of the session to find. ///
data string /// A that represents the text data to send. ///
completed Action /// An Action<bool> delegate that references the method(s) called when /// the send is complete. /// A passed to this delegate is true if the send is /// complete successfully; otherwise, false. ///
return void

TryGetServiceHost() public method

Tries to get a WebSocket service host with the specified servicePath.
public TryGetServiceHost ( string servicePath, WebSocketSharp.Server.WebSocketServiceHost &serviceHost ) : bool
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
serviceHost WebSocketSharp.Server.WebSocketServiceHost /// When this method returns, a instance /// that represents the WebSocket service host if it's successfully found; /// otherwise, . This parameter is passed uninitialized. ///
return bool

this() public method

Gets a WebSocket service host with the specified servicePath.
public this ( string servicePath ) : WebSocketSharp.Server.WebSocketServiceHost
servicePath string /// A that represents the absolute path to the WebSocket /// service to find. ///
return WebSocketSharp.Server.WebSocketServiceHost