Nakama .NET Client SDK 3.5.0
Nakama .NET Client SDK
Loading...
Searching...
No Matches
Nakama.WebSocketAdapter Class Reference

An adapter which uses the WebSocket protocol with Nakama server. More...

Inheritance diagram for Nakama.WebSocketAdapter:
Nakama.ISocketAdapter

Public Member Functions

 WebSocketAdapter (int keepAliveIntervalSec=KeepAliveIntervalSec, int sendTimeoutSec=SendTimeoutSec, int maxMessageReadSize=MaxMessageReadSize)
 
 WebSocketAdapter (WebSocketClientOptions options, int sendTimeoutSec, int maxMessageReadSize)
 
Task CloseAsync ()
 Close the socket with an asynchronous operation. More...
 
async Task ConnectAsync (Uri uri, int timeout)
 Connect to the server with an asynchronous operation.
Parameters
uriThe URI of the server.
timeoutThe timeout for the connect attempt on the socket.
More...
 
Task SendAsync (ArraySegment< byte > buffer, bool reliable=true, CancellationToken canceller=default)
 Send data to the server with an asynchronous operation.
Parameters
bufferThe buffer with the message to send.
reliableIf the message should be sent reliably (will be ignored by some protocols).
cancellerA cancellation token used to propagate when the operation should be canceled.
More...
 
override string ToString ()
 
Task CloseAsync ()
 Close the socket with an asynchronous operation. More...
 
Task ConnectAsync (Uri uri, int timeout)
 Connect to the server with an asynchronous operation. More...
 
Task SendAsync (ArraySegment< byte > buffer, bool reliable=true, CancellationToken canceller=default)
 Send data to the server with an asynchronous operation. More...
 

Properties

bool IsConnected [get]
 If the WebSocket is connected. More...
 
bool IsConnecting [get]
 If the WebSocket is connecting. More...
 
- Properties inherited from Nakama.ISocketAdapter
bool IsConnected [get]
 If the socket is connected. More...
 
bool IsConnecting [get]
 If the socket is connecting. More...
 

Events

Action Connected
 
Action Closed
 
Action< Exception > ReceivedError
 
Action< ArraySegment< byte > > Received
 
- Events inherited from Nakama.ISocketAdapter
Action Connected
 An event dispatched when the socket is connected. More...
 
Action Closed
 An event dispatched when the socket is disconnected. More...
 
Action< Exception > ReceivedError
 An event dispatched when the socket has an error when connected. More...
 
Action< ArraySegment< byte > > Received
 An event dispatched when the socket receives a message. More...
 

Detailed Description

An adapter which uses the WebSocket protocol with Nakama server.

Constructor & Destructor Documentation

◆ WebSocketAdapter() [1/2]

Nakama.WebSocketAdapter.WebSocketAdapter ( int  keepAliveIntervalSec = KeepAliveIntervalSec,
int  sendTimeoutSec = SendTimeoutSec,
int  maxMessageReadSize = MaxMessageReadSize 
)
inline

◆ WebSocketAdapter() [2/2]

Nakama.WebSocketAdapter.WebSocketAdapter ( WebSocketClientOptions  options,
int  sendTimeoutSec,
int  maxMessageReadSize 
)
inline

Member Function Documentation

◆ CloseAsync()

Task Nakama.WebSocketAdapter.CloseAsync ( )
inline

Close the socket with an asynchronous operation.

Implements Nakama.ISocketAdapter.

◆ ConnectAsync()

async Task Nakama.WebSocketAdapter.ConnectAsync ( Uri  uri,
int  timeout 
)
inline

Connect to the server with an asynchronous operation.

Parameters
uriThe URI of the server.
timeoutThe timeout for the connect attempt on the socket.

Implements Nakama.ISocketAdapter.

◆ SendAsync()

Task Nakama.WebSocketAdapter.SendAsync ( ArraySegment< byte >  buffer,
bool  reliable = true,
CancellationToken  canceller = default 
)
inline

Send data to the server with an asynchronous operation.

Parameters
bufferThe buffer with the message to send.
reliableIf the message should be sent reliably (will be ignored by some protocols).
cancellerA cancellation token used to propagate when the operation should be canceled.

Implements Nakama.ISocketAdapter.

◆ ToString()

override string Nakama.WebSocketAdapter.ToString ( )

Property Documentation

◆ IsConnected

bool Nakama.WebSocketAdapter.IsConnected
get

If the WebSocket is connected.

Implements Nakama.ISocketAdapter.

◆ IsConnecting

bool Nakama.WebSocketAdapter.IsConnecting
get

If the WebSocket is connecting.

Implements Nakama.ISocketAdapter.

Event Documentation

◆ Closed

Action Nakama.WebSocketAdapter.Closed

◆ Connected

Action Nakama.WebSocketAdapter.Connected

◆ Received

Action<ArraySegment<byte> > Nakama.WebSocketAdapter.Received

◆ ReceivedError

Action<Exception> Nakama.WebSocketAdapter.ReceivedError


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