#include <websocketinterface.h>
Public Member Functions | |
WebSocketInterface (WebSocketService &service) | |
virtual | ~WebSocketInterface () |
virtual bool | init (utility::ErrorState &errorState) override |
template<typename T > | |
T & | as () |
template<typename T > | |
const T & | as () const |
![]() | |
Resource () | |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Protected Member Functions | |
void | addEvent (WebSocketEventPtr newEvent) |
Protected Attributes | |
std::queue< WebSocketEventPtr > | mEvents |
std::mutex | mEventMutex |
WebSocketService * | mService = nullptr |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Base class of all web-socket clients and servers. Don't derive from this directly but from nap::IWebSocketClient and nap::IWebSocketServer instead. Every web-socket interface is registered with the nap::WebSocketService. This allows a client or server to receive web-socket messages and connection updates on a different thread than the application thread. By itself this object does not interface with an endpoint. Use the nap::WebSocketClient and nap::WebSocketServer instead.
WebSocketInterface | ( | WebSocketService & | service | ) |
Constructor
service | the web-socket service that forwards events to the application. |
|
virtual |
|
protected |
Called when the end point receives a new event. Adds the event to the list of events to be processed on the application thread.
newEvent | the web-socket event. |
T & as |
Returns the interface as an interface of type T. The interface is either a server or client, for example: this->as<nap::WebSocketServer>(); Asserts if the interface isn't of type T.
const T & as |
Returns the interface as an interface of type T. The interface is either a server or client, for example: this->as<nap::WebSocketServer>(); Asserts if the interface isn't of type T.
|
overridevirtual |
Initialize this object after de-serialization
errorState | contains the error message when initialization fails |
Reimplemented from Object.
Reimplemented in IWebSocketClient, IWebSocketServer, and PortalWebSocketServer.
|
protected |
|
protected |
|
protected |