C# Class WebSocketSharp.Server.WebSocketSessionManager

Manages the sessions to a Websocket service.
Afficher le fichier Open project: uken/websocket-sharp Class Usage Examples

Private Properties

Свойство Type Description
Add string
Broadcast void
Broadcast void
Broadping bool>.Dictionary
Remove bool
Start void
Stop void
Stop void
WebSocketSessionManager System
WebSocketSessionManager System
broadcast void
broadcast void
broadcastAsync void
broadcastAsync void
checkIfCanSend string
createID string
setSweepTimer void
tryGetSession bool

Méthodes publiques

Méthode Description
Broadcast ( byte data ) : void

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

Broadcast ( string data ) : void

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

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

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

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 service.

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 service.

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

Broadping ( ) : bool>.Dictionary

Sends Pings to all clients of the WebSocket service.

Broadping ( string message ) : bool>.Dictionary

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

CloseSession ( string id ) : void

Closes the session with the specified id.

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

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

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

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

PingTo ( string id ) : bool

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

PingTo ( string id, string message ) : bool

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

SendTo ( string id, byte data ) : void

Sends a binary data to the client on the session with the specified id.

SendTo ( string id, string data ) : void

Sends a text data to the client on the session with the specified id.

SendToAsync ( string id, 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.

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

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

Sends a binary data asynchronously to the client on the session with the specified id.

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

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

Sends a text data asynchronously to the client on the session with the specified id.

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

Sweep ( ) : void

Cleans up the inactive sessions.

TryGetSession ( string id, IWebSocketSession &session ) : bool

Tries to get a WebSocket session information with the specified id.

this ( string id ) : IWebSocketSession

Gets a WebSocket session information with the specified id.

Private Methods

Méthode Description
Add ( IWebSocketSession session ) : string
Broadcast ( Opcode opcode, Stream stream, Stream>.Dictionary cache ) : void
Broadcast ( Opcode opcode, byte data, byte[]>.Dictionary cache ) : void
Broadping ( byte frameAsBytes, int timeOut ) : bool>.Dictionary
Remove ( string id ) : bool
Start ( ) : void
Stop ( CloseEventArgs args, byte frameAsBytes ) : void
Stop ( byte data, bool send ) : void
WebSocketSessionManager ( ) : System
WebSocketSessionManager ( System.Logger logger ) : System
broadcast ( Opcode opcode, Stream stream, System.Action completed ) : void
broadcast ( Opcode opcode, byte data, System.Action completed ) : void
broadcastAsync ( Opcode opcode, Stream stream, System.Action completed ) : void
broadcastAsync ( Opcode opcode, byte data, System.Action completed ) : void
checkIfCanSend ( Func checkParams ) : string
createID ( ) : string
setSweepTimer ( double interval ) : void
tryGetSession ( string id, IWebSocketSession &session ) : bool

Method Details

Broadcast() public méthode

Broadcasts a binary data to all clients of the WebSocket service.
public Broadcast ( byte data ) : void
data byte /// An array of that represents the binary data /// to broadcast. ///
Résultat void

Broadcast() public méthode

Broadcasts a text data to all clients of the WebSocket service.
public Broadcast ( string data ) : void
data string /// A that represents the text data to broadcast. ///
Résultat void

BroadcastAsync() public méthode

Broadcasts a binary data from the specified Stream asynchronously to all clients of the WebSocket service.
This method doesn't wait for the broadcast to be complete.
public BroadcastAsync ( Stream stream, int length, System.Action completed ) : void
stream 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. ///
Résultat void

BroadcastAsync() public méthode

Broadcasts a binary data asynchronously to all clients of the WebSocket service.
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. ///
Résultat void

BroadcastAsync() public méthode

Broadcasts a text data asynchronously to all clients of the WebSocket service.
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. ///
Résultat void

Broadping() public méthode

Sends Pings to all clients of the WebSocket service.
public Broadping ( ) : bool>.Dictionary
Résultat bool>.Dictionary

Broadping() public méthode

Sends Pings with the specified message to all clients of the WebSocket service.
public Broadping ( string message ) : bool>.Dictionary
message string /// A that represents the message to send. ///
Résultat bool>.Dictionary

CloseSession() public méthode

Closes the session with the specified id.
public CloseSession ( string id ) : void
id string /// A that represents the ID of the session to close. ///
Résultat void

CloseSession() public méthode

Closes the session with the specified id, code and reason.
public CloseSession ( string id, CloseStatusCode code, string reason ) : void
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. ///
Résultat void

CloseSession() public méthode

Closes the session with the specified id, code and reason.
public CloseSession ( string id, ushort code, string reason ) : void
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. ///
Résultat void

PingTo() public méthode

Sends a Ping to the client associated with the specified id.
public PingTo ( string id ) : bool
id string /// A that represents the ID of the session to send the /// Ping to. ///
Résultat bool

PingTo() public méthode

Sends a Ping with the specified message to the client associated with the specified id.
public PingTo ( string id, string message ) : bool
id string /// A that represents the ID of the session to send the /// Ping to. ///
message string /// A that represents the message to send. ///
Résultat bool

SendTo() public méthode

Sends a binary data to the client on the session with the specified id.
public SendTo ( string id, byte data ) : void
id string /// A that represents the ID of the session to find. ///
data byte /// An array of that represents the binary data to send. ///
Résultat void

SendTo() public méthode

Sends a text data to the client on the session with the specified id.
public SendTo ( string id, string data ) : void
id string /// A that represents the ID of the session to find. /// data to. ///
data string /// A that represents the text data to send. ///
Résultat void

SendToAsync() public méthode

Sends a binary data from the specified Stream asynchronously to the client on the session with the specified id.
This method doesn't wait for the send to be complete.
public SendToAsync ( string id, Stream stream, int length, Action completed ) : void
id string /// A that represents the ID of the session to find. ///
stream 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. ///
Résultat void

SendToAsync() public méthode

Sends a binary data asynchronously to the client on the session with the specified id.
This method doesn't wait for the send to be complete.
public SendToAsync ( string id, byte data, Action completed ) : void
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. ///
Résultat void

SendToAsync() public méthode

Sends a text data asynchronously to the client on the session with the specified id.
This method doesn't wait for the send to be complete.
public SendToAsync ( string id, string data, Action completed ) : void
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. ///
Résultat void

Sweep() public méthode

Cleans up the inactive sessions.
public Sweep ( ) : void
Résultat void

TryGetSession() public méthode

Tries to get a WebSocket session information with the specified id.
public TryGetSession ( string id, IWebSocketSession &session ) : bool
id string /// A that represents the ID of the session to get. ///
session IWebSocketSession /// When this method returns, a instance that /// represents the session if it's successfully found; otherwise, /// . This parameter is passed uninitialized. ///
Résultat bool

this() public méthode

Gets a WebSocket session information with the specified id.
public this ( string id ) : IWebSocketSession
id string /// A that represents the ID of the WebSocket session to /// get. ///
Résultat IWebSocketSession