GlidingSquirrel : SBRL.GlidingSquirrel.Websocket Namespace

WebsocketServer Class

The main Websockets Server class. Inherit from this to create your own websockets-capable HTTP server! Note that if you don't want or need the Websockets support, you should inherit from SBRL.GlidingSquirrel.Http.HttpServer instead.

Syntax

public abstract class WebsocketServer : SBRL.GlidingSquirrel.Http.HttpServer

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

Members

See Also: Inherited members from SBRL.GlidingSquirrel.Http.HttpServer.

Public Constructors

Initialises a new WebsocketServer.

Public Fields

readonly
BindAddress System.Net.IPAddress . The address the server will bind to. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
Clients List<WebsocketClient> . A list of currently connected clients.
IdleTimeout int . The maximum allowed time to wait for data from the client, in milliseconds. After this time has elapsed the connection will be closed. Note that this doesn't affect a connection once a websocket has been fully initialised. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
static readonly
MagicChallengeKey string . The magic challenge key. Used in the initial handshake.
MaximumUrlLength int . The maximum allowed length for urls. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
MimeTypeOverrides Dictionary<string, string> . Override MIME type mappings. Values specified here will be sued in place of any found in MimeSharp's database. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
PingInterval TimeSpan . The time that a client is allowed to remain idle beforer a ping packet is sent to it. Defaults to 1 minute.
readonly
Port int . The port the server will listen on. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)

Protected Fields

canceller System.Threading.CancellationTokenSource . The cancellation token we use to stop the server and all it's threads (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
server SBRL.GlidingSquirrel.Http.TcpListenerExtended . The underlying tcp listener. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)

Public Properties

[read-only]
BindEndpoint string . The endpoint the server will listen on. Useful for logging. You can change this value via the BindAddress and Port properties. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)

Protected Properties

[read-only]
cancellationToken System.Threading.CancellationToken . Shortcut property to get the cancellation token directly. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)

Public Methods

Broadcast (byte[]) : System.Threading.Tasks.Task
Broadcasts the specified binary message to all connected clients who aren't currently in the process of closing their connection.
Broadcast (string) : System.Threading.Tasks.Task
Broadcasts the specified message to all connected clients who aren't currently in the process of closing their connection.
CloseAll (string) : System.Threading.Tasks.Task
Closes all the currently open connections with the specified reason.
CloseAll (WebsocketCloseReason, string) : System.Threading.Tasks.Task
Closes all the currently open connections with the specified reason code and message.
DoHandleRequest (SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse) : System.Threading.Tasks.Task<SBRL.GlidingSquirrel.Http.HttpConnectionAction>
Handles a single request from a client. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
DoHandleRequest (SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse, object) : System.Threading.Tasks.Task<SBRL.GlidingSquirrel.Http.HttpConnectionAction>
Handles a single request from a client. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
HandleClient (System.Net.Sockets.TcpClient) : System.Threading.Tasks.Task<SBRL.GlidingSquirrel.Http.HttpConnectionAction>
Handles a single HTTP client connection. Usually you don't want to call this directly - Start() will for you :-) (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
abstract
HandleClientConnected (object, ClientConnectedEventArgs) : System.Threading.Tasks.Task
Gets called automatically when a client has connected.
abstract
HandleClientDisconnected (object, ClientDisconnectedEventArgs) : System.Threading.Tasks.Task
Gets called automatically when a client has disconnected.
abstract
HandleHttpRequest (SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse) : System.Threading.Tasks.Task
Gets called automatically to handle regular HTTP requests.
abstract
HandleHttpRequest (SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse) : System.Threading.Tasks.Task<SBRL.GlidingSquirrel.Http.HttpConnectionAction>
Gets called automatically to handle regular HTTP requests.
override
HandleRequest (SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse) : System.Threading.Tasks.Task<SBRL.GlidingSquirrel.Http.HttpConnectionAction>
Handles incoming HTTP requests. WebsocketServer implements this as it needs to eat certain requests that are actually Websocket handshakes. You'll probably want to take a look at the requests too - that's what WebsocketServer.HandleHttpRequest(SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse) is for.
abstract
HandleRequest (SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse) : System.Threading.Tasks.Task<SBRL.GlidingSquirrel.Http.HttpConnectionAction>
Used to handle a request. Called in a separate thread. If an exception is thrown here, it's caught and sent back to the user - which may not be what you want. todo: Upgrades to that part of the system are pending. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
override
HandleRequest (SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse, object) : System.Threading.Tasks.Task<SBRL.GlidingSquirrel.Http.HttpConnectionAction>
Handles incoming HTTP requests. WebsocketServer implements this as it needs to eat certain requests that are actually Websocket handshakes. You'll probably want to take a look at the requests too - that's what WebsocketServer.HandleHttpRequest(SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse) is for.
abstract
HandleRequest (SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse, object) : System.Threading.Tasks.Task<SBRL.GlidingSquirrel.Http.HttpConnectionAction>
Used to handle a request. Called in a separate thread. If an exception is thrown here, it's caught and sent back to the user - which may not be what you want. todo: Upgrades to that part of the system are pending. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
LookupMimeType (string) : string
Fetches the mime type for a given file path. This method applies (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
Reflect (WebsocketClient, byte[]) : System.Threading.Tasks.Task
Reflects the specified binary message to all connected clients who both aren't the sender and aren't currently in the process of closing their connection.
Reflect (WebsocketClient, string) : System.Threading.Tasks.Task
Reflects the specified message to all connected clients who both aren't the sender and aren't currently in the process of closing their connection.
abstract
ShouldAcceptConnection (SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse) : bool
Gets called automatically to determine if a connection should be accepted or not.
Start () : System.Threading.Tasks.Task
Starts listening for requests. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
Stop ()
Stops the server. If overriding, please remember to call this method! (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
Stop (string)
Stops the Websocket (and HTTP) server, sending the specified reason text to all currently connected Websocket clients.

Protected Methods

doMaintenance (object)
Performs maintenance at regular intervals.
handleClientConnection (object)
Handles a websocket client connection. Designed to be called in a separate thread.
handleClientDisconnection (object, ClientDisconnectedEventArgs) : System.Threading.Tasks.Task
Fired when a client disconnects from the server. This is attached to the ClientDisconnected event on the WebsocketClient by the websocket server to track when clients disconnect.
HandleClientThreadRoot (object)
Handles requests from a specified client. This is the root method that is called when spawning a new thread to handle the client. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)
override
setup () : System.Threading.Tasks.Task
Performs websockets-specific setup logic.
abstract
setup () : System.Threading.Tasks.Task
Called once the server is listening for requests, but before the first request is accepted. Use to perform setup logic, obviously :P (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)

Public Events

OnClientConnected Occurs when a new (websocket) client connects.
OnClientDisconnected Occurs when a (websocket) client disconnects.
OnShutdown Fired when the server shuts down. (Inherited from SBRL.GlidingSquirrel.Http.HttpServer.)

Member Details

WebsocketServer Constructor

Initialises a new WebsocketServer.

Syntax

public WebsocketServer (System.Net.IPAddress inBindAddress, int inPort)

Parameters

inBindAddress
The IP address to bind to.
inPort
The port to listen on.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

Broadcast Method

Broadcasts the specified binary message to all connected clients who aren't currently in the process of closing their connection.

Syntax

[System.Diagnostics.DebuggerStepThrough]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(SBRL.GlidingSquirrel.Websocket.WebsocketServer/<Broadcast>d__18))]
public System.Threading.Tasks.Task Broadcast (byte[] message)

Parameters

message
The message to broadcast.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

Broadcast Method

Broadcasts the specified message to all connected clients who aren't currently in the process of closing their connection.

Syntax

[System.Diagnostics.DebuggerStepThrough]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(SBRL.GlidingSquirrel.Websocket.WebsocketServer/<Broadcast>d__17))]
public System.Threading.Tasks.Task Broadcast (string message)

Parameters

message
The message to broadcast.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

Clients Field

A list of currently connected clients.

Syntax

public List<WebsocketClient> Clients

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

CloseAll Method

Closes all the currently open connections with the specified reason.

Syntax

[System.Diagnostics.DebuggerStepThrough]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(SBRL.GlidingSquirrel.Websocket.WebsocketServer/<CloseAll>d__21))]
public System.Threading.Tasks.Task CloseAll (string reason)

Parameters

reason
The reason message to send when closing connections.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

CloseAll Method

Closes all the currently open connections with the specified reason code and message.

Syntax

[System.Diagnostics.DebuggerStepThrough]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(SBRL.GlidingSquirrel.Websocket.WebsocketServer/<CloseAll>d__22))]
public System.Threading.Tasks.Task CloseAll (WebsocketCloseReason reason, string closingMessage)

Parameters

reason
The reason code to send when closing connections.
closingMessage
The closing message text to send.

Returns

Documentation for this section has not yet been entered.

Remarks

Unless you've got a very unusual use case, CloseAll(string) is probably what you want.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

doMaintenance Method

Performs maintenance at regular intervals.

Syntax

[System.Diagnostics.DebuggerStepThrough]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(SBRL.GlidingSquirrel.Websocket.WebsocketServer/<doMaintenance>d__16))]
protected void doMaintenance (object state)

Parameters

state
Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

HandleClientConnected Method

Gets called automatically when a client has connected.

Syntax

public abstract System.Threading.Tasks.Task HandleClientConnected (object sender, ClientConnectedEventArgs eventArgs)

Parameters

sender
The WebsocketClient object representing the client that has connected.
eventArgs
The client connected event arguments.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

handleClientConnection Method

Handles a websocket client connection. Designed to be called in a separate thread.

Syntax

[System.Diagnostics.DebuggerStepThrough]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(SBRL.GlidingSquirrel.Websocket.WebsocketServer/<handleClientConnection>d__14))]
protected void handleClientConnection (object rawClientConnectionRequest)

Parameters

rawClientConnectionRequest
Raw client connection request.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

HandleClientDisconnected Method

Gets called automatically when a client has disconnected.

Syntax

public abstract System.Threading.Tasks.Task HandleClientDisconnected (object sender, ClientDisconnectedEventArgs eventArgs)

Parameters

sender
The WebsocketClient object representing the client that has disconnected.
eventArgs
The client disconnected event arguments.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

handleClientDisconnection Method

Fired when a client disconnects from the server. This is attached to the ClientDisconnected event on the WebsocketClient by the websocket server to track when clients disconnect.

Syntax

[System.Diagnostics.DebuggerStepThrough]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(SBRL.GlidingSquirrel.Websocket.WebsocketServer/<handleClientDisconnection>d__15))]
protected System.Threading.Tasks.Task handleClientDisconnection (object sender, ClientDisconnectedEventArgs eventArgs)

Parameters

sender
The sender of this ClientDisconnected event.
eventArgs
The event arguments attached to this ClientDisconnected event.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

HandleHttpRequest Method

Gets called automatically to handle regular HTTP requests.

Syntax

Parameters

request
The HTTP request.
response
The HTTP response to send back.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 1.0.6562.35419, 1.0.6562.35930

HandleHttpRequest Method

Gets called automatically to handle regular HTTP requests.

Syntax

Parameters

request
The HTTP request.
response
The HTTP response to send back.

Returns

What to do with the connection.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

HandleRequest Method

Handles incoming HTTP requests. WebsocketServer implements this as it needs to eat certain requests that are actually Websocket handshakes. You'll probably want to take a look at the requests too - that's what WebsocketServer.HandleHttpRequest(SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse) is for.

Syntax

[System.Diagnostics.DebuggerStepThrough]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(SBRL.GlidingSquirrel.Websocket.WebsocketServer/<HandleRequest>d__11))]
public override sealed System.Threading.Tasks.Task<SBRL.GlidingSquirrel.Http.HttpConnectionAction> HandleRequest (SBRL.GlidingSquirrel.Http.HttpRequest request, SBRL.GlidingSquirrel.Http.HttpResponse response)

Parameters

request
The HTTP request to handle.
response
The HTTP response to send back to the client.

Returns

Tells HttpServer to leave the request alone.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

HandleRequest Method

Handles incoming HTTP requests. WebsocketServer implements this as it needs to eat certain requests that are actually Websocket handshakes. You'll probably want to take a look at the requests too - that's what WebsocketServer.HandleHttpRequest(SBRL.GlidingSquirrel.Http.HttpRequest, SBRL.GlidingSquirrel.Http.HttpResponse) is for.

Syntax

[System.Diagnostics.DebuggerStepThrough]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(SBRL.GlidingSquirrel.Websocket.WebsocketServer/<HandleRequest>d__10))]
public override sealed System.Threading.Tasks.Task<SBRL.GlidingSquirrel.Http.HttpConnectionAction> HandleRequest (SBRL.GlidingSquirrel.Http.HttpRequest request, SBRL.GlidingSquirrel.Http.HttpResponse response, object connectionState)

Parameters

request
The HTTP request to handle.
response
The HTTP response to send back to the client.
connectionState
Documentation for this section has not yet been entered.

Returns

Tells HttpServer to leave the request alone.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 1.0.6620.40465

MagicChallengeKey Field

The magic challenge key. Used in the initial handshake.

Syntax

public static readonly string MagicChallengeKey

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

OnClientConnected Event

Occurs when a new (websocket) client connects.

Syntax

public event ClientConnectedEventHandler OnClientConnected

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

OnClientDisconnected Event

Occurs when a (websocket) client disconnects.

Syntax

public event ClientDisconnectedEventHandler OnClientDisconnected

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

PingInterval Field

The time that a client is allowed to remain idle beforer a ping packet is sent to it. Defaults to 1 minute.

Syntax

public TimeSpan PingInterval

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

Reflect Method

Reflects the specified binary message to all connected clients who both aren't the sender and aren't currently in the process of closing their connection.

Syntax

[System.Diagnostics.DebuggerStepThrough]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(SBRL.GlidingSquirrel.Websocket.WebsocketServer/<Reflect>d__20))]
public System.Threading.Tasks.Task Reflect (WebsocketClient sender, byte[] message)

Parameters

sender
The WebsocketClient sending the message.
message
The message to broadcast.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

Reflect Method

Reflects the specified message to all connected clients who both aren't the sender and aren't currently in the process of closing their connection.

Syntax

[System.Diagnostics.DebuggerStepThrough]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(SBRL.GlidingSquirrel.Websocket.WebsocketServer/<Reflect>d__19))]
public System.Threading.Tasks.Task Reflect (WebsocketClient sender, string message)

Parameters

sender
The WebsocketClient sending the message.
message
The message to broadcast.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

setup Method

Performs websockets-specific setup logic.

Syntax

protected override System.Threading.Tasks.Task setup ()

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6562.35419, 1.0.6562.35930, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

ShouldAcceptConnection Method

Gets called automatically to determine if a connection should be accepted or not.

Syntax

public abstract bool ShouldAcceptConnection (SBRL.GlidingSquirrel.Http.HttpRequest connectionRequest, SBRL.GlidingSquirrel.Http.HttpResponse connectionResponse)

Parameters

connectionRequest
The connection request received.
connectionResponse
The response to the connection that will be sent. If true is returned, then the contents of this may be largely overwritten. If false is returned, then this response will be sent verbatim to the client.

Returns

Whether the connection should be accepted or not.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 0.0.0.0, 1.0.6566.37627, 1.0.6620.40465, 1.0.6629.34522, 1.0.6744.34319, 1.0.6744.34540, 1.0.6746.26208, 1.0.6746.26412, 1.0.6746.26518, 1.0.6746.26789, 1.0.6746.26804, 1.0.6746.26825, 1.0.6746.26834, 1.0.6746.26851, 1.0.6746.26854, 1.0.6746.27195, 1.0.6746.27200, 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265

Stop Method

Stops the Websocket (and HTTP) server, sending the specified reason text to all currently connected Websocket clients.

Syntax

public void Stop (string reason)

Parameters

reason
The reason text to send to the clients when disconnecting them.

Remarks

Note that the regular .Stop() method does infact disconnect all Websocket clients cleanly - you don't need to call this method explicitly in order to get a clean exit.

Requirements

Namespace: SBRL.GlidingSquirrel.Websocket
Assembly: GlidingSquirrel (in GlidingSquirrel.dll)
Assembly Versions: 1.0.6786.21077, 1.0.6786.21083, 1.0.6786.38758, 1.0.6786.38797, 1.0.6786.38837, 1.0.6786.38901, 1.0.6786.38913, 1.0.6786.39083, 1.0.6786.39119, 1.0.6786.39136, 1.0.6786.39265