![]() |
Nakama C++ Client SDK 2.5.1
Client for Nakama Server
|
#include <NRtTransportInterface.h>
Public Types | |
using | ConnectCallback = std::function< void()> |
using | DisconnectCallback = std::function< void(const NRtClientDisconnectInfo &info)> |
using | ErrorCallback = std::function< void(const std::string &)> |
using | MessageCallback = std::function< void(const NBytes &)> |
Public Member Functions | |
virtual | ~NRtTransportInterface () |
void | setConnectCallback (ConnectCallback callback) |
void | setDisconnectCallback (DisconnectCallback callback) |
void | setErrorCallback (ErrorCallback callback) |
void | setMessageCallback (MessageCallback callback) |
virtual void | setActivityTimeout (uint32_t timeoutMs)=0 |
virtual uint32_t | getActivityTimeout () const =0 |
virtual void | tick ()=0 |
virtual void | connect (const std::string &url, NRtTransportType type)=0 |
virtual bool | isConnected () const |
virtual void | disconnect ()=0 |
virtual bool | send (const NBytes &data)=0 |
Protected Member Functions | |
void | fireOnConnected () |
void | fireOnDisconnected (const NRtClientDisconnectInfo &info) |
void | fireOnError (const std::string &description) |
void | fireOnMessage (const NBytes &data) |
Protected Attributes | |
ConnectCallback | _connectCallback |
DisconnectCallback | _disconnectCallback |
ErrorCallback | _errorCallback |
MessageCallback | _messageCallback |
bool | _connected = false |
A real-time transport interface to send and receive data.
using NRtTransportInterface::ConnectCallback = std::function<void()> |
using NRtTransportInterface::DisconnectCallback = std::function<void(const NRtClientDisconnectInfo& info)> |
using NRtTransportInterface::ErrorCallback = std::function<void(const std::string&)> |
using NRtTransportInterface::MessageCallback = std::function<void(const NBytes&)> |
|
inlinevirtual |
|
pure virtual |
Connect to the server.
url | The URL of websocket server. |
type | The transport type: Text or Binary. |
|
pure virtual |
Close the connection with the server.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
pure virtual |
Get activity timeout, milliseconds.
|
inlinevirtual |
|
pure virtual |
Send bytes data to the server.
data | The byte data to send. |
|
pure virtual |
Set activity timeout, milliseconds.
If no any message (including ping) received from server during activity timeout then connection will be closed. Set 0 to disable (default value).
|
inline |
|
inline |
|
inline |
|
inline |
|
pure virtual |
Pumps requests queue in your thread. NRtClientInterface
will call this from it's tick
.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |