| WebSocket Class | 
 Inheritance Hierarchy
Inheritance HierarchyNamespace: Sfs2X.WebSocketSharp
 Syntax
Syntaxpublic class WebSocket : IDisposable
The WebSocket type exposes the following members.
 Constructors
Constructors| Name | Description | |
|---|---|---|
|  | WebSocket | 
            Initializes a new instance of the WebSocket class with
            url and optionally protocols.
             | 
 Properties
Properties| Name | Description | |
|---|---|---|
|  | Compression | 
            Gets or sets the compression method used to compress a message.
             | 
|  | Cookies | 
            Gets the HTTP cookies included in the handshake request/response.
             | 
|  | Credentials | 
            Gets the credentials for the HTTP authentication (Basic/Digest).
             | 
|  | EmitOnPing | 
            Gets or sets a value indicating whether a OnMessage event
            is emitted when a ping is received.
             | 
|  | EnableRedirection | 
            Gets or sets a value indicating whether the URL redirection for
            the handshake request is allowed.
             | 
|  | Extensions | 
            Gets the extensions selected by server.
             | 
|  | IsAlive | 
            Gets a value indicating whether the connection is alive.
             | 
|  | IsSecure | 
            Gets a value indicating whether a secure connection is used.
             | 
|  | Log | 
            Gets the logging function.
             | 
|  | Origin | 
            Gets or sets the value of the HTTP Origin header to send with
            the handshake request.
             | 
|  | Protocol | 
            Gets the name of subprotocol selected by the server.
             | 
|  | ReadyState | 
            Gets the current state of the connection.
             | 
|  | SslConfiguration | 
            Gets the configuration for secure connection.
             | 
|  | Url | 
            Gets the URL to which to connect.
             | 
|  | WaitTime | 
            Gets or sets the time to wait for the response to the ping or close.
             | 
 Methods
Methods| Name | Description | |
|---|---|---|
|  | Accept | 
            Accepts the handshake request.
             | 
|  | AcceptAsync | 
            Accepts the handshake request asynchronously.
             | 
|  | Close | 
            Closes the connection.
             | 
|  | Close(CloseStatusCode) | 
            Closes the connection with the specified code.
             | 
|  | Close(UInt16) | 
            Closes the connection with the specified code.
             | 
|  | Close(CloseStatusCode, String) | 
            Closes the connection with the specified code and reason.
             | 
|  | Close(UInt16, String) | 
            Closes the connection with the specified code and reason.
             | 
|  | CloseAsync | 
            Closes the connection asynchronously.
             | 
|  | CloseAsync(CloseStatusCode) | 
            Closes the connection asynchronously with the specified code.
             | 
|  | CloseAsync(UInt16) | 
            Closes the connection asynchronously with the specified code.
             | 
|  | CloseAsync(CloseStatusCode, String) | 
            Closes the connection asynchronously with the specified code and reason.
             | 
|  | CloseAsync(UInt16, String) | 
            Closes the connection asynchronously with the specified code and reason.
             | 
|  | Connect | 
            Establishes a connection.
             | 
|  | ConnectAsync | 
            Establishes a connection asynchronously.
             | 
|  | Ping | 
            Sends a ping using the WebSocket connection.
             | 
|  | Ping(String) | 
            Sends a ping with message using the WebSocket
            connection.
             | 
|  | Send(Byte) | 
            Sends the specified data using the WebSocket connection.
             | 
|  | Send(FileInfo) | 
            Sends the specified file using the WebSocket connection.
             | 
|  | Send(String) | 
            Sends the specified data using the WebSocket connection.
             | 
|  | Send(Stream, Int32) | 
            Sends the data from the specified stream using the WebSocket connection.
             | 
|  | SendAsync(Byte, ActionBoolean) | 
            Sends the specified data asynchronously using the WebSocket connection.
             | 
|  | SendAsync(FileInfo, ActionBoolean) | 
            Sends the specified file asynchronously using the WebSocket connection.
             | 
|  | SendAsync(String, ActionBoolean) | 
            Sends the specified data asynchronously using the WebSocket connection.
             | 
|  | SendAsync(Stream, Int32, ActionBoolean) | 
            Sends the data from the specified stream asynchronously using
            the WebSocket connection.
             | 
|  | SetCookie | 
            Sets an HTTP cookie to send with the handshake request.
             | 
|  | SetCredentials | 
            Sets the credentials for the HTTP authentication (Basic/Digest).
             | 
|  | SetProxy | 
            Sets the URL of the HTTP proxy server through which to connect and
            the credentials for the HTTP proxy authentication (Basic/Digest).
             | 
 Events
Events| Name | Description | |
|---|---|---|
|  | OnClose | 
            Occurs when the WebSocket connection has been closed.
             | 
|  | OnError | 
            Occurs when the WebSocket gets an error.
             | 
|  | OnMessage | 
            Occurs when the WebSocket receives a message.
             | 
|  | OnOpen | 
            Occurs when the WebSocket connection has been established.
             | 
 Remarks
RemarksThis class provides a set of methods and properties for two-way communication using the WebSocket protocol.
The WebSocket protocol is defined in RFC 6455.
 See Also
See Also