Interface IWebSocketServerFactory
- Namespace
- Alis.Core.Network
- Assembly
- Alis.dll
Web socket server factory used to open web socket server connections
public interface IWebSocketServerFactoryMethods
AcceptWebSocketAsync(WebSocketHttpContext, CancellationToken)
Accept web socket with default options Call ReadHttpHeaderFromStreamAsync first to get WebSocketHttpContext
Task<WebSocket> AcceptWebSocketAsync(WebSocketHttpContext context, CancellationToken token = default)Parameters
contextWebSocketHttpContext-
The http context used to initiate this web socket request
tokenCancellationToken-
The optional cancellation token
Returns
AcceptWebSocketAsync(WebSocketHttpContext, WebSocketServerOptions, CancellationToken)
Accept web socket with options specified Call ReadHttpHeaderFromStreamAsync first to get WebSocketHttpContext
Task<WebSocket> AcceptWebSocketAsync(WebSocketHttpContext context, WebSocketServerOptions options, CancellationToken token = default)Parameters
contextWebSocketHttpContext-
The http context used to initiate this web socket request
optionsWebSocketServerOptions-
The web socket options
tokenCancellationToken-
The optional cancellation token
Returns
ReadHttpHeaderFromStreamAsync(Stream, CancellationToken)
Reads a http header information from a stream and decodes the parts relating to the WebSocket protocot upgrade
Task<WebSocketHttpContext> ReadHttpHeaderFromStreamAsync(Stream stream, CancellationToken token = default)Parameters
streamStream-
The network stream
tokenCancellationToken-
The optional cancellation token
Returns
- Task<WebSocketHttpContext>
-
Http data read from the stream