Table of Contents

Class HttpWebSocket

Namespace
Sisk.Core.Http.Streams
Assembly
Sisk.Core.dll

Provides an persistent bi-directional socket between the client and the HTTP server.

public sealed class HttpWebSocket
Inheritance
HttpWebSocket
Inherited Members

Properties

HttpRequest

Gets the HttpRequest object which created this Web Socket instance.

Identifier

Gets an unique identifier label to this Web Socket connection, useful for finding this connection's reference later.

IsClosed

Gets an boolean indicating if this Web Socket connection is closed.

MaxAttempts

Gets or sets the maximum number of attempts to send a failed message before the server closes the connection. Set it to -1 to don't close the connection on failed attempts.

PingPolicy

Gets the HttpStreamPingPolicy for this HTTP web socket connection.

State

Gets or sets an object linked with this WebSocket session.

WaitTimeout

Gets or sets the maximum wait time for synchronous listener methods like WaitNext().

Methods

Close()

Closes the connection between the client and the server and returns an HTTP response indicating that the connection has been terminated. This method will not throw an exception if the connection is already closed.

Send(byte[])

Sends an binary message to the remote point.

Send(byte[], int, int)

Sends an binary message to the remote point.

Send(object)

Sends an text message to the remote point.

Send(ReadOnlyMemory<byte>)

Sends an binary message to the remote point.

Send(string)

Sends an text message to the remote point.

SendAsync(byte[])

Asynchronously sends an binary message to the remote point.

SendAsync(object)

Asynchronously sends an message to the remote point.

SendAsync(string)

Asynchronously sends an text message to the remote point.

WaitForClose()

Blocks the current call stack until the connection is terminated by either the client or the server.

WaitForClose(TimeSpan)

Blocks the current call stack until the connection is terminated by the client or the server, limited to the maximum timeout.

WaitNext()

Blocks the current thread and waits the next incoming message from this web socket instance.

WaitNext(TimeSpan)

Blocks the current thread and waits the next incoming message from this web socket instance within the maximum defined timeout.

WithPing(Action<HttpStreamPingPolicy>)

Configures the ping policy for this instance of HTTP Web Socket.

WithPing(string, TimeSpan)

Configures the ping policy for this instance of HTTP Web Socket.

Events

OnReceive

Represents the event which is called when this web socket receives an message from remote origin.