C# Class WebSocketSharp.Server.WebSocketService

Provides the basic functions of the WebSocket service used by the WebSocket service host.
The WebSocketService class is an abstract class.
Inheritance: IWebSocketSession
Afficher le fichier Open project: uken/websocket-sharp Class Usage Examples

Méthodes protégées

Méthode Description
Error ( string message ) : void

Calls the OnError method with the specified message.

OnClose ( CloseEventArgs e ) : void

Is called when the WebSocket connection has been closed.

OnError ( ErrorEventArgs e ) : void

Is called when the inner WebSocket or current WebSocketService gets an error.

OnMessage ( MessageEventArgs e ) : void

Is called when the inner WebSocket receives a data frame.

OnOpen ( ) : void

Is called when the WebSocket connection has been established.

Send ( FileInfo file ) : void

Sends the specified file as a binary data to the client on the current session in the WebSocket service.

Send ( byte data ) : void

Sends a binary data to the client on the current session in the WebSocket service.

Send ( string data ) : void

Sends a text data to the client on the current session in the WebSocket service.

SendAsync ( FileInfo file, Action completed ) : void

Sends the specified file as a binary data asynchronously to the client on the current session in the WebSocket service.

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

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

Sends a binary data from the specified Stream asynchronously to the client on the current session in the WebSocket service.

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

SendAsync ( byte data, Action completed ) : void

Sends a binary data asynchronously to the client on the current session in the WebSocket service.

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

SendAsync ( string data, Action completed ) : void

Sends a text data asynchronously to the client on the current session in the WebSocket service.

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

ValidateCookies ( WebSocketSharp.Net.CookieCollection request, WebSocketSharp.Net.CookieCollection response ) : bool

Validates the HTTP Cookies used in the WebSocket connection request.

This method is called when the inner WebSocket validates the WebSocket connection request.

WebSocketService ( ) : System

Initializes a new instance of the WebSocketService class.

Private Methods

Méthode Description
Start ( WebSocketContext context, WebSocketSessionManager sessions ) : void
onClose ( object sender, CloseEventArgs e ) : void
onError ( object sender, ErrorEventArgs e ) : void
onMessage ( object sender, MessageEventArgs e ) : void
onOpen ( object sender, EventArgs e ) : void

Method Details

Error() protected méthode

Calls the OnError method with the specified message.
protected Error ( string message ) : void
message string /// A that represents the error message. ///
Résultat void

OnClose() protected méthode

Is called when the WebSocket connection has been closed.
protected OnClose ( CloseEventArgs e ) : void
e CloseEventArgs /// A that contains the event data associated /// with an inner event. ///
Résultat void

OnError() protected méthode

Is called when the inner WebSocket or current WebSocketService gets an error.
protected OnError ( ErrorEventArgs e ) : void
e ErrorEventArgs /// An that contains the event data associated /// with an inner event. ///
Résultat void

OnMessage() protected méthode

Is called when the inner WebSocket receives a data frame.
protected OnMessage ( MessageEventArgs e ) : void
e MessageEventArgs /// A that contains the event data associated /// with an inner event. ///
Résultat void

OnOpen() protected méthode

Is called when the WebSocket connection has been established.
protected OnOpen ( ) : void
Résultat void

Send() protected méthode

Sends the specified file as a binary data to the client on the current session in the WebSocket service.
protected Send ( FileInfo file ) : void
file FileInfo /// A that represents the file to send. ///
Résultat void

Send() protected méthode

Sends a binary data to the client on the current session in the WebSocket service.
protected Send ( byte data ) : void
data byte /// An array of that represents the binary data to send. ///
Résultat void

Send() protected méthode

Sends a text data to the client on the current session in the WebSocket service.
protected Send ( string data ) : void
data string /// A that represents the text data to send. ///
Résultat void

SendAsync() protected méthode

Sends the specified file as a binary data asynchronously to the client on the current session in the WebSocket service.
This method doesn't wait for the send to be complete.
protected SendAsync ( FileInfo file, Action completed ) : void
file FileInfo /// A that represents the file 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

SendAsync() protected méthode

Sends a binary data from the specified Stream asynchronously to the client on the current session in the WebSocket service.
This method doesn't wait for the send to be complete.
protected SendAsync ( System.Stream stream, int length, Action completed ) : void
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. ///
Résultat void

SendAsync() protected méthode

Sends a binary data asynchronously to the client on the current session in the WebSocket service.
This method doesn't wait for the send to be complete.
protected SendAsync ( byte data, Action completed ) : void
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

SendAsync() protected méthode

Sends a text data asynchronously to the client on the current session in the WebSocket service.
This method doesn't wait for the send to be complete.
protected SendAsync ( string data, Action completed ) : void
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

ValidateCookies() protected méthode

Validates the HTTP Cookies used in the WebSocket connection request.
This method is called when the inner WebSocket validates the WebSocket connection request.
protected ValidateCookies ( WebSocketSharp.Net.CookieCollection request, WebSocketSharp.Net.CookieCollection response ) : bool
request WebSocketSharp.Net.CookieCollection /// A that contains the collection of the /// cookies to validate. ///
response WebSocketSharp.Net.CookieCollection /// A that receives the cookies to send to the /// client. ///
Résultat bool

WebSocketService() protected méthode

Initializes a new instance of the WebSocketService class.
protected WebSocketService ( ) : System
Résultat System