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

Ping Pong Manager used to facilitate ping pong WebSocket messages. More...

Inheritance diagram for Nakama.Ninja.WebSockets.PingPongManager:
Nakama.Ninja.WebSockets.IPingPongManager

Public Member Functions

 PingPongManager (Guid guid, WebSocket webSocket, TimeSpan keepAliveInterval, CancellationToken cancellationToken)
 Initialises a new instance of the PingPongManager to facilitate ping pong WebSocket messages. If you are manually creating an instance of this class then it is advisable to set keepAliveInterval to TimeSpan.Zero when you create the WebSocket instance (using a factory) otherwise you may be automatically be sending duplicate Ping messages (see keepAliveInterval below)
 
async Task SendPing (ArraySegment< byte > payload, CancellationToken cancellation)
 Sends a ping frame.
 

Protected Member Functions

virtual void OnPong (PongEventArgs e)
 

Events

EventHandler< PongEventArgsPong
 Raised when a Pong frame is received.
 
- Events inherited from Nakama.Ninja.WebSockets.IPingPongManager
EventHandler< PongEventArgsPong
 Raised when a Pong frame is received.
 

Detailed Description

Ping Pong Manager used to facilitate ping pong WebSocket messages.

Constructor & Destructor Documentation

◆ PingPongManager()

Nakama.Ninja.WebSockets.PingPongManager.PingPongManager ( Guid  guid,
WebSocket  webSocket,
TimeSpan  keepAliveInterval,
CancellationToken  cancellationToken 
)
inline

Initialises a new instance of the PingPongManager to facilitate ping pong WebSocket messages. If you are manually creating an instance of this class then it is advisable to set keepAliveInterval to TimeSpan.Zero when you create the WebSocket instance (using a factory) otherwise you may be automatically be sending duplicate Ping messages (see keepAliveInterval below)

Parameters
webSocketThe web socket used to listen to ping messages and send pong messages
keepAliveIntervalThe time between automatically sending ping messages. Set this to TimeSpan.Zero if you with to manually control sending ping messages.
cancellationTokenThe token used to cancel a pending ping send AND the automatic sending of ping messages if keepAliveInterval is positive

Member Function Documentation

◆ OnPong()

virtual void Nakama.Ninja.WebSockets.PingPongManager.OnPong ( PongEventArgs  e)
inlineprotectedvirtual

◆ SendPing()

async Task Nakama.Ninja.WebSockets.PingPongManager.SendPing ( ArraySegment< byte >  payload,
CancellationToken  cancellation 
)
inline

Sends a ping frame.

Parameters
payloadThe payload (must be 125 bytes of less)
cancellationThe cancellation token

Implements Nakama.Ninja.WebSockets.IPingPongManager.

Event Documentation

◆ Pong

EventHandler<PongEventArgs> Nakama.Ninja.WebSockets.PingPongManager.Pong

Raised when a Pong frame is received.


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