#include </opt/build/repo/nap/system_modules/napportal/src/portalwebsocketserver.h>
Public Member Functions | |
PortalWebSocketServer (PortalService &service) | |
virtual bool | init (utility::ErrorState &error) override |
virtual void | onDestroy () override |
bool | send (PortalEventPtr event, const WebSocketConnection &connection, utility::ErrorState &error) |
bool | broadcast (PortalEventPtr event, utility::ErrorState &error) |
![]() | |
IWebSocketServer (WebSocketService &service) | |
![]() | |
WebSocketInterface (WebSocketService &service) | |
virtual | ~WebSocketInterface () |
template<typename T > | |
T & | as () |
template<typename T > | |
const T & | as () const |
![]() | |
Resource () | |
![]() | |
Object () | |
virtual | ~Object () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Public Attributes | |
bool | mSendWebSocketEvents = true |
Property: 'SendWebSocketEvents' send events to WebSocket service as well as portal service. More... | |
bool | mVerbose = true |
Property: 'Verbose' log server message to portal event conversion failures. More... | |
![]() | |
ResourcePtr< IWebSocketServerEndPoint > | mEndPoint |
Property: 'EndPoint' the server endpoint that manages all client connections. More... | |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
![]() | |
void | addEvent (WebSocketEventPtr newEvent) |
![]() | |
std::queue< WebSocketEventPtr > | mEvents |
std::mutex | mEventMutex |
WebSocketService * | mService = nullptr |
Portal WebSocket server implementation for sending and receiving API messages formatted as portal events. Implements the IWebSocketServer interface.
PortalWebSocketServer | ( | PortalService & | service | ) |
Constructor
service | handle to the portal service |
bool broadcast | ( | PortalEventPtr | event, |
utility::ErrorState & | error | ||
) |
Broadcasts a portal event to all connected clients.
event | the portal event to broadcast to the clients |
error | contains the error if broadcasting fails |
|
overridevirtual |
Registers the portal WebSocket server with the portal service.
error | contains the error if initialization fails. |
Reimplemented from IWebSocketServer.
|
overridevirtual |
Unregisters the portal WebSocket server with the portal service.
Reimplemented from IWebSocketServer.
bool send | ( | PortalEventPtr | event, |
const WebSocketConnection & | connection, | ||
utility::ErrorState & | error | ||
) |
Sends a portal event to a client.
event | the portal event to send to the client |
connection | the client connection handle |
error | contains the error if sending fails |
bool mSendWebSocketEvents = true |
Property: 'SendWebSocketEvents' send events to WebSocket service as well as portal service.
bool mVerbose = true |
Property: 'Verbose' log server message to portal event conversion failures.