Implements the WebSocket interface.
See Also: Inherited members from object.
|
Initializes a new instance of the WebSocketSharp.WebSocket class with the specified WebSocket URL and subprotocols. | |
|
Initializes a new instance of the WebSocketSharp.WebSocket class with the specified WebSocket URL, OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols. |
[read-only] | Cookies | IEnumerable<WebSocketSharp.Net.Cookie> . Gets the cookies used in the WebSocket opening handshake. |
[read-only] | Extensions | string . Gets the extensions selected by the server. |
[read-only] | IsAlive | bool . Gets a value indicating whether a connection is alive. |
[read-only] | IsSecure | bool . Gets a value indicating whether a connection is secure. |
|
Origin | string . Gets or sets the value of the Origin header used in the WebSocket opening handshake. |
[read-only] | Protocol | string . Gets the subprotocol selected by the server. |
[read-only] | ReadyState | WsState . Gets the state of the connection. |
[read-only] | Url | Uri . Gets the WebSocket URL. |
|
Close
()Closes the WebSocket connection and releases all associated resources. |
|
|
Close
(ushort)Closes the WebSocket connection with the specified code and releases all associated resources. |
|
|
Close
(CloseStatusCode)Closes the WebSocket connection with the specified code and releases all associated resources. |
|
|
Close
(ushort, string)Closes the WebSocket connection with the specified code and reason, and releases all associated resources. |
|
|
Close
(CloseStatusCode, string)Closes the WebSocket connection with the specified code and reason, and releases all associated resources. |
|
|
Connect
()Establishes a WebSocket connection. |
|
|
Dispose
()Closes the WebSocket connection and releases all associated resources. |
|
|
Ping
()Pings using the WebSocket connection. |
|
|
Ping
(string)Pings with the specified message using the WebSocket connection. |
|
|
Send
(byte[])Sends a binary data using the WebSocket connection. |
|
|
Send
(System.IO.FileInfo)Sends a binary data using the WebSocket connection. |
|
|
Send
(string)Sends a text data using the WebSocket connection. |
|
|
SendAsync
(byte[], Action)Sends a binary data asynchronously using the WebSocket connection. |
|
|
SendAsync
(System.IO.FileInfo, Action)Sends a binary data asynchronously using the WebSocket connection. |
|
|
SendAsync
(string, Action)Sends a text data asynchronously using the WebSocket connection. |
|
|
SetCookie
(WebSocketSharp.Net.Cookie)Sets a WebSocketSharp.Net.Cookie used in the WebSocket opening handshake. |
|
OnClose | Occurs when the WebSocketSharp.WebSocket receives a Close frame or the Close method is called. |
|
OnError | Occurs when the WebSocketSharp.WebSocket gets an error. |
|
OnMessage | Occurs when the WebSocketSharp.WebSocket receives a data frame. |
|
OnOpen | Occurs when the WebSocket connection has been established. |
Initializes a new instance of the WebSocketSharp.WebSocket class with the specified WebSocket URL and subprotocols.
Syntax
Parameters
Exceptions
Type Reason ArgumentNullException url is null. ArgumentException url is not valid WebSocket URL. Remarks
Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Initializes a new instance of the WebSocketSharp.WebSocket class with the specified WebSocket URL, OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
Syntax
public WebSocket (string url, EventHandler onOpen, EventHandler<MessageEventArgs> onMessage, EventHandler<ErrorEventArgs> onError, EventHandler<CloseEventArgs> onClose, params string[] protocols)Parameters
- url
- A string that contains a WebSocket URL to connect.
- onOpen
- An WebSocket.OnOpen event handler.
- onMessage
- An WebSocket.OnMessage event handler.
- onError
- An WebSocket.OnError event handler.
- onClose
- An WebSocket.OnClose event handler.
- protocols
- An array of string that contains the WebSocket subprotocols if any.
Exceptions
Type Reason ArgumentNullException url is null. ArgumentException url is not valid WebSocket URL. Remarks
This constructor initializes a new instance of the WebSocketSharp.WebSocket class and establishes a WebSocket connection.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Closes the WebSocket connection and releases all associated resources.
Syntax
public void Close ()Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Closes the WebSocket connection with the specified code and releases all associated resources.
Syntax
Parameters
- code
- A ushort that indicates the status code for closure.
Remarks
Emits a WebSocket.OnError event if code is not in the allowable range of the WebSocket close status code, and do nothing any more.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Closes the WebSocket connection with the specified code and releases all associated resources.
Syntax
public void Close (CloseStatusCode code)Parameters
- code
- One of the WebSocketSharp.CloseStatusCode values that indicates the status code for closure.
Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Closes the WebSocket connection with the specified code and reason, and releases all associated resources.
Syntax
Parameters
Remarks
Emits a WebSocket.OnError event if code is not in the allowable range of the WebSocket close status code, and do nothing any more.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Closes the WebSocket connection with the specified code and reason, and releases all associated resources.
Syntax
Parameters
- code
- One of the WebSocketSharp.CloseStatusCode values that indicates the status code for closure.
- reason
- A string that contains the reason for closure.
Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Establishes a WebSocket connection.
Syntax
public void Connect ()Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets the cookies used in the WebSocket opening handshake.
Syntax
public IEnumerable<WebSocketSharp.Net.Cookie> Cookies { get; }Value
An IEnumerable<Cookie> interface that provides an enumerator which supports the iteration over the collection of cookies.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Closes the WebSocket connection and releases all associated resources.
Syntax
public void Dispose ()Remarks
This method closes the WebSocket connection with the CloseStatusCode.AWAY.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets the extensions selected by the server.
Syntax
public string Extensions { get; }Value
A string that contains the extensions if any. The default is string.Empty. (Currently this will only ever be the string.Empty.)Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets a value indicating whether a connection is alive.
Syntax
public bool IsAlive { get; }Value
true if the connection is alive; otherwise, false.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets a value indicating whether a connection is secure.
Syntax
public bool IsSecure { get; }Value
true if the connection is secure; otherwise, false.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the WebSocketSharp.WebSocket receives a Close frame or the Close method is called.
Syntax
public event EventHandler<CloseEventArgs> OnCloseRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the WebSocketSharp.WebSocket gets an error.
Syntax
public event EventHandler<ErrorEventArgs> OnErrorRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the WebSocketSharp.WebSocket receives a data frame.
Syntax
public event EventHandler<MessageEventArgs> OnMessageRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the WebSocket connection has been established.
Syntax
public event EventHandler OnOpenRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets or sets the value of the Origin header used in the WebSocket opening handshake.
Syntax
public string Origin { get; set; }Value
A string that contains the value of the HTTP Origin header to send. The default is string.Empty.
The value of the Origin header has the following syntax: <scheme>://<host>[:<port>]
Remarks
A WebSocketSharp.WebSocket instance does not send the Origin header in the WebSocket opening handshake if the value of this property is string.Empty.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Pings using the WebSocket connection.
Syntax
public bool Ping ()Returns
true if the WebSocketSharp.WebSocket receives a Pong in a time; otherwise, false.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Pings with the specified message using the WebSocket connection.
Syntax
Parameters
- message
- A string that contains a message.
Returns
true if the WebSocketSharp.WebSocket receives a Pong in a time; otherwise, false.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets the subprotocol selected by the server.
Syntax
public string Protocol { get; }Value
A string that contains the subprotocol if any. By default, String.Empty.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets the state of the connection.
Syntax
public WsState ReadyState { get; }Value
One of the WebSocketSharp.WsState. By default, WsState.CONNECTING.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Sends a binary data using the WebSocket connection.
Syntax
Parameters
- data
- An array of byte that contains a binary data to send.
Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Sends a binary data using the WebSocket connection.
Syntax
public void Send (System.IO.FileInfo file)Parameters
- file
- A System.IO.FileInfo that contains a binary data to send.
Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Sends a text data using the WebSocket connection.
Syntax
Parameters
- data
- A string that contains a text data to send.
Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Sends a binary data asynchronously using the WebSocket connection.
Syntax
Parameters
Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Sends a binary data asynchronously using the WebSocket connection.
Syntax
Parameters
- file
- A System.IO.FileInfo that contains a binary data to send.
- completed
- An Action delegate that references the method(s) called when the asynchronous operation completes.
Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Sends a text data asynchronously using the WebSocket connection.
Syntax
Parameters
Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Sets a WebSocketSharp.Net.Cookie used in the WebSocket opening handshake.
Syntax
public void SetCookie (WebSocketSharp.Net.Cookie cookie)Parameters
- cookie
- A WebSocketSharp.Net.Cookie that contains an HTTP Cookie to set.
Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets the WebSocket URL.
Syntax
public Uri Url { get; }Value
A Uri that contains the WebSocket URL.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp
Assembly: websocket-sharp (in websocket-sharp.dll)