Interface IWebSocket
Interface to create a WebSocket implementation.
Namespace: EmbedIO.WebSockets
Syntax
public interface IWebSocket : IDisposable
Properties
State
Gets the state.
Declaration
WebSocketState State { get; }
Property Value
Type | Description |
---|---|
WebSocketState | The state. |
Methods
CloseAsync(CancellationToken)
Closes the web socket asynchronously.
Declaration
Task CloseAsync(CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task | The task object representing the asynchronous operation. |
CloseAsync(CloseStatusCode, String, CancellationToken)
Closes the web socket asynchronously.
Declaration
Task CloseAsync(CloseStatusCode code, string comment = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CloseStatusCode | code | The code. |
String | comment | The comment. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task | The task object representing the asynchronous operation. |
SendAsync(Byte[], Boolean, CancellationToken)
Sends the buffer to the web socket asynchronously.
Declaration
Task SendAsync(byte[] buffer, bool isText, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The buffer. |
Boolean | isText | if set to |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous of send data using websocket. |