Nakama .NET Client SDK 3.8.0
Nakama .NET Client SDK
Loading...
Searching...
No Matches
Nakama.Ninja.WebSockets.WebSocketServerFactory Class Reference

Web socket server factory used to open web socket server connections. More...

Inheritance diagram for Nakama.Ninja.WebSockets.WebSocketServerFactory:
Nakama.Ninja.WebSockets.IWebSocketServerFactory

Public Member Functions

 WebSocketServerFactory ()
 Initialises a new instance of the WebSocketServerFactory class without caring about internal buffers.
 
 WebSocketServerFactory (Func< MemoryStream > bufferFactory)
 Initialises a new instance of the WebSocketClientFactory class with control over internal buffer creation.
 
async Task< WebSocketHttpContextReadHttpHeaderFromStreamAsync (System.IO.Stream stream, CancellationToken token=default(CancellationToken))
 Reads a http header information from a stream and decodes the parts relating to the WebSocket protocot upgrade.
 
async Task< WebSocket > AcceptWebSocketAsync (WebSocketHttpContext context, CancellationToken token=default(CancellationToken))
 Accept web socket with default options Call ReadHttpHeaderFromStreamAsync first to get WebSocketHttpContext.
 
async Task< WebSocket > AcceptWebSocketAsync (WebSocketHttpContext context, WebSocketServerOptions options, CancellationToken token=default(CancellationToken))
 Accept web socket with options specified Call ReadHttpHeaderFromStreamAsync first to get WebSocketHttpContext.
 

Detailed Description

Web socket server factory used to open web socket server connections.

Constructor & Destructor Documentation

◆ WebSocketServerFactory() [1/2]

Nakama.Ninja.WebSockets.WebSocketServerFactory.WebSocketServerFactory ( )
inline

Initialises a new instance of the WebSocketServerFactory class without caring about internal buffers.

◆ WebSocketServerFactory() [2/2]

Nakama.Ninja.WebSockets.WebSocketServerFactory.WebSocketServerFactory ( Func< MemoryStream >  bufferFactory)
inline

Initialises a new instance of the WebSocketClientFactory class with control over internal buffer creation.

Parameters
bufferPoolUsed to get a memory stream. Feel free to implement your own buffer pool. MemoryStreams will be disposed when no longer needed and can be returned to the pool.

Member Function Documentation

◆ AcceptWebSocketAsync() [1/2]

async Task< WebSocket > Nakama.Ninja.WebSockets.WebSocketServerFactory.AcceptWebSocketAsync ( WebSocketHttpContext  context,
CancellationToken  token = default(CancellationToken) 
)
inline

Accept web socket with default options Call ReadHttpHeaderFromStreamAsync first to get WebSocketHttpContext.

Parameters
contextThe http context used to initiate this web socket request
tokenThe optional cancellation token
Returns
A connected web socket

Implements Nakama.Ninja.WebSockets.IWebSocketServerFactory.

◆ AcceptWebSocketAsync() [2/2]

async Task< WebSocket > Nakama.Ninja.WebSockets.WebSocketServerFactory.AcceptWebSocketAsync ( WebSocketHttpContext  context,
WebSocketServerOptions  options,
CancellationToken  token = default(CancellationToken) 
)
inline

Accept web socket with options specified Call ReadHttpHeaderFromStreamAsync first to get WebSocketHttpContext.

Parameters
contextThe http context used to initiate this web socket request
optionsThe web socket options
tokenThe optional cancellation token
Returns
A connected web socket

Implements Nakama.Ninja.WebSockets.IWebSocketServerFactory.

◆ ReadHttpHeaderFromStreamAsync()

async Task< WebSocketHttpContext > Nakama.Ninja.WebSockets.WebSocketServerFactory.ReadHttpHeaderFromStreamAsync ( System::IO::Stream  stream,
CancellationToken  token = default(CancellationToken) 
)
inline

Reads a http header information from a stream and decodes the parts relating to the WebSocket protocot upgrade.

Parameters
streamThe network stream
tokenThe optional cancellation token
Returns
Http data read from the stream

Implements Nakama.Ninja.WebSockets.IWebSocketServerFactory.


The documentation for this class was generated from the following file: