Web socket client factory used to open web socket client connections.
More...
|
| WebSocketClientFactory () |
| Initialises a new instance of the WebSocketClientFactory class without caring about internal buffers.
|
|
| WebSocketClientFactory (Func< MemoryStream > bufferFactory) |
| Initialises a new instance of the WebSocketClientFactory class with control over internal buffer creation.
|
|
async Task< WebSocket > | ConnectAsync (Uri uri, CancellationToken token=default(CancellationToken)) |
| Connect with default options.
|
|
async Task< WebSocket > | ConnectAsync (Uri uri, WebSocketClientOptions options, CancellationToken token=default(CancellationToken)) |
| Connect with options specified.
|
|
async Task< WebSocket > | ConnectAsync (System.IO.Stream responseStream, string secWebSocketKey, WebSocketClientOptions options, CancellationToken token=default(CancellationToken)) |
| Connect with a stream that has already been opened and HTTP websocket upgrade request sent This function will check the handshake response from the server and proceed if successful Use this function if you have specific requirements to open a conenction like using special http headers and cookies You will have to build your own HTTP websocket upgrade request You may not even choose to use TCP/IP and this function will allow you to do that.
|
|
|
virtual void | TlsAuthenticateAsClient (SslStream sslStream, string host) |
| Override this if you need more fine grained control over the TLS handshake like setting the SslProtocol or adding a client certificate.
|
|
virtual async Task< System.IO.Stream > | GetStream (Guid loggingGuid, bool isSecure, bool noDelay, string host, int port, CancellationToken cancellationToken) |
| Override this if you need more control over how the stream used for the websocket is created. It does not event need to be a TCP stream.
|
|
Web socket client factory used to open web socket client connections.
◆ WebSocketClientFactory() [1/2]
Nakama.Ninja.WebSockets.WebSocketClientFactory.WebSocketClientFactory |
( |
| ) |
|
|
inline |
Initialises a new instance of the WebSocketClientFactory class without caring about internal buffers.
◆ WebSocketClientFactory() [2/2]
Nakama.Ninja.WebSockets.WebSocketClientFactory.WebSocketClientFactory |
( |
Func< MemoryStream > |
bufferFactory | ) |
|
|
inline |
Initialises a new instance of the WebSocketClientFactory class with control over internal buffer creation.
- Parameters
-
bufferFactory | Used 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. |
◆ ConnectAsync() [1/3]
async Task< WebSocket > Nakama.Ninja.WebSockets.WebSocketClientFactory.ConnectAsync |
( |
System::IO::Stream |
responseStream, |
|
|
string |
secWebSocketKey, |
|
|
WebSocketClientOptions |
options, |
|
|
CancellationToken |
token = default(CancellationToken) |
|
) |
| |
|
inline |
Connect with a stream that has already been opened and HTTP websocket upgrade request sent This function will check the handshake response from the server and proceed if successful Use this function if you have specific requirements to open a conenction like using special http headers and cookies You will have to build your own HTTP websocket upgrade request You may not even choose to use TCP/IP and this function will allow you to do that.
- Parameters
-
responseStream | The full duplex response stream from the server |
secWebSocketKey | The secWebSocketKey you used in the handshake request |
options | The WebSocket client options |
token | The optional cancellation token |
- Returns
Implements Nakama.Ninja.WebSockets.IWebSocketClientFactory.
◆ ConnectAsync() [2/3]
async Task< WebSocket > Nakama.Ninja.WebSockets.WebSocketClientFactory.ConnectAsync |
( |
Uri |
uri, |
|
|
CancellationToken |
token = default(CancellationToken) |
|
) |
| |
|
inline |
Connect with default options.
- Parameters
-
uri | The WebSocket uri to connect to (e.g. ws://example.com or wss://example.com for SSL) |
token | The optional cancellation token |
- Returns
- A connected web socket instance
Implements Nakama.Ninja.WebSockets.IWebSocketClientFactory.
◆ ConnectAsync() [3/3]
async Task< WebSocket > Nakama.Ninja.WebSockets.WebSocketClientFactory.ConnectAsync |
( |
Uri |
uri, |
|
|
WebSocketClientOptions |
options, |
|
|
CancellationToken |
token = default(CancellationToken) |
|
) |
| |
|
inline |
Connect with options specified.
- Parameters
-
uri | The WebSocket uri to connect to (e.g. ws://example.com or wss://example.com for SSL) |
options | The WebSocket client options |
token | The optional cancellation token |
- Returns
- A connected web socket instance
Implements Nakama.Ninja.WebSockets.IWebSocketClientFactory.
◆ GetStream()
virtual async Task< System.IO.Stream > Nakama.Ninja.WebSockets.WebSocketClientFactory.GetStream |
( |
Guid |
loggingGuid, |
|
|
bool |
isSecure, |
|
|
bool |
noDelay, |
|
|
string |
host, |
|
|
int |
port, |
|
|
CancellationToken |
cancellationToken |
|
) |
| |
|
inlineprotectedvirtual |
Override this if you need more control over how the stream used for the websocket is created. It does not event need to be a TCP stream.
- Parameters
-
loggingGuid | For logging purposes only |
isSecure | Make a secure connection |
noDelay | Set to true to send a message immediately with the least amount of latency (typical usage for chat) |
host | The destination host (can be an IP address) |
port | The destination port |
cancellationToken | Used to cancel the request |
- Returns
- A connected and open stream
◆ TlsAuthenticateAsClient()
virtual void Nakama.Ninja.WebSockets.WebSocketClientFactory.TlsAuthenticateAsClient |
( |
SslStream |
sslStream, |
|
|
string |
host |
|
) |
| |
|
inlineprotectedvirtual |
Override this if you need more fine grained control over the TLS handshake like setting the SslProtocol or adding a client certificate.
The documentation for this class was generated from the following file: