NAP
Public Member Functions | Protected Member Functions | List of all members
WebSocketService Class Reference

#include <websocketservice.h>

Public Member Functions

 WebSocketService (ServiceConfiguration *configuration)
 
bool init (nap::utility::ErrorState &errorState) override
 
- Public Member Functions inherited from Service
UNPREFIXED_MODULE_NAME_INPUTCASE Service (ServiceConfiguration *configuration)
 
virtual void getDependentServices (std::vector< rtti::TypeInfo > &dependencies) override
 
virtual void shutdown () override
 
 Service (ServiceConfiguration *configuration)
 
virtual ~Service ()
 
CoregetCore ()
 
const CoregetCore () const
 
std::string getTypeName () const
 
const ModulegetModule () const
 
 Service (Service &)=delete
 
Serviceoperator= (const Service &)=delete
 
 Service (Service &&)=delete
 
Serviceoperator= (Service &&)=delete
 

Protected Member Functions

virtual void registerObjectCreators (rtti::Factory &factory) override
 
virtual void update (double deltaTime) override
 
- Protected Member Functions inherited from Service
virtual void getDependentServices (std::vector< rtti::TypeInfo > &dependencies)
 
virtual void created ()
 
virtual void preUpdate (double deltaTime)
 
virtual void postUpdate (double deltaTime)
 
virtual void preShutdown ()
 
virtual void shutdown ()
 
virtual void preResourcesLoaded ()
 
virtual void postResourcesLoaded ()
 
template<typename SERVICE_CONFIG >
SERVICE_CONFIG * getConfiguration ()
 
template<typename SERVICE_CONFIG >
const SERVICE_CONFIG * getConfiguration () const
 
std::string getIniFilePath () const
 
std::string getIniFilePath (const std::string &appendix) const
 

Description

Processes client and server web-socket events. Events are generated by clients and servers on a background thread after receiving web-socket information from an endpoint. This service ensures that all web-socket events are forwarded safely to one or multiple instances of a nap::WebSocketComponent on the application (main) thread. To receive events in your running application declare and listen to a nap::WebSocketComponent.

Inheritance diagram for WebSocketService:
[legend]
Collaboration diagram for WebSocketService:
[legend]

Constructor & Destructor Documentation

◆ WebSocketService()

WebSocketService ( ServiceConfiguration configuration)

Member Function Documentation

◆ init()

bool init ( nap::utility::ErrorState errorState)
overridevirtual

Initializes the service

Parameters
errorStatecontains the error message on failure
Returns
if the video service was initialized correctly

Reimplemented from Service.

◆ registerObjectCreators()

virtual void registerObjectCreators ( rtti::Factory factory)
overrideprotectedvirtual

Registers all objects that need a specific way of construction.

Parameters
factorythe factory to register the object creators with.

Reimplemented from Service.

◆ update()

virtual void update ( double  deltaTime)
overrideprotectedvirtual

Processes all received web-socket events from all registered web socket servers. The events are forwarded to all the registered websocket components. This function is called automatically by the application loop.

Parameters
deltaTimetime in between calls in seconds.

Reimplemented from Service.