#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) |
Public Member Functions inherited from IWebSocketServer | |
| IWebSocketServer (WebSocketService &service) | |
Public Member Functions inherited from WebSocketInterface | |
| WebSocketInterface (WebSocketService &service) | |
| virtual | ~WebSocketInterface () |
| template<typename T > | |
| T & | as () |
| template<typename T > | |
| const T & | as () const |
Public Member Functions inherited from Resource | |
| Resource () | |
Public Member Functions inherited from Object | |
| 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... | |
Public Attributes inherited from IWebSocketServer | |
| ResourcePtr< IWebSocketServerEndPoint > | mEndPoint |
| Property: 'EndPoint' the server endpoint that manages all client connections. More... | |
Public Attributes inherited from Object | |
| std::string | mID |
| Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
| static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Protected Member Functions inherited from WebSocketInterface | |
| void | addEvent (WebSocketEventPtr newEvent) |
Protected Attributes inherited from WebSocketInterface | |
| 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.