#include <iwebsocketclientendpoint.h>
Public Member Functions | |
virtual bool | send (const WebSocketConnection &connection, const std::string &message, EWebSocketOPCode code, nap::utility::ErrorState &error)=0 |
virtual bool | send (const WebSocketConnection &connection, void const *payload, int length, EWebSocketOPCode code, nap::utility::ErrorState &error)=0 |
![]() | |
virtual bool | start (utility::ErrorState &errorState) |
virtual void | stop () |
![]() | |
Resource () | |
![]() | |
Object () | |
virtual | ~Object () |
virtual bool | init (utility::ErrorState &errorState) |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Public Attributes | |
bool | mLogConnectionUpdates = true |
Property: "LogConnectionUpdates" if client / server connection information is logged to the console. More... | |
EWebSocketLogLevel | mLibraryLogLevel = EWebSocketLogLevel::Warning |
Property: "LibraryLogLevel" library related equal to or higher than requested are logged. More... | |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Protected Member Functions | |
virtual bool | registerClient (IWebSocketClient &client, utility::ErrorState &error)=0 |
virtual void | unregisterClient (const IWebSocketClient &client)=0 |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Web socket client endpoint interface. Manages a list of client-server connections and acts as the main portal for the client to the server. Every web-socket client receives connection updates and messages from an endpoint. The endpoint is a device that can be started and stopped.
When stopped all active client-server connections are closed. This occurs when file changes are detected and the content of the application is hot-reloaded. Typically an application has only one endpoint. Multiple clients can reference the same endpoint. Every connection update and message is forwarded to the client from a background thread. To receive connection updates and messages a client must be dervied from nap::IWebSocketClient.
Note that depending on your operating system you might have to run the application as administrator to open a web-socket.
|
protectedpure virtual |
Connects a nap client to a server. The new connection is managed by this endpoint. The client is added to the list of internally managed clients.
client | the client to register |
error | contains the error is registration fails. |
Implemented in WebSocketClientEndPointSetup< config >, and WebSocketClientEndPointSetup< wspp::ConfigTLS >.
|
pure virtual |
Sends a message to a server.
connection | the client connection to the server. |
message | the message to send. |
code | type of message. |
error | contains the error if sending fails. |
Implemented in WebSocketClientEndPointSetup< config >, and WebSocketClientEndPointSetup< wspp::ConfigTLS >.
|
pure virtual |
Sends a message using the given payload and opcode to a server.
connection | the client connection to the server. |
payload | the message buffer. |
length | buffer size in bytes. |
code | type of message. |
error | contains the error if sending fails. |
Implemented in WebSocketClientEndPointSetup< config >, and WebSocketClientEndPointSetup< wspp::ConfigTLS >.
|
protectedpure virtual |
Removes a client (resource) from the list of actively managed connection. If the client connection is currently open it will be closed. Asserts if the client isn't part of the system or can't be removed.
client | the client to remove. |
Implemented in WebSocketClientEndPointSetup< config >, and WebSocketClientEndPointSetup< wspp::ConfigTLS >.
EWebSocketLogLevel mLibraryLogLevel = EWebSocketLogLevel::Warning |
Property: "LibraryLogLevel" library related equal to or higher than requested are logged.
bool mLogConnectionUpdates = true |
Property: "LogConnectionUpdates" if client / server connection information is logged to the console.