NAP
Public Member Functions | Public Attributes | List of all members
WebSocketComponentInstance Class Reference

#include <websocketcomponent.h>

Public Member Functions

 WebSocketComponentInstance (EntityInstance &entity, Component &resource)
 
virtual ~WebSocketComponentInstance ()
 
virtual bool init (utility::ErrorState &errorState) override
 
const WebSocketInterfacegetInterface () const
 
WebSocketInterfacegetInterface ()
 
- Public Member Functions inherited from ComponentInstance
 ComponentInstance (EntityInstance &entity, Component &resource)
 
virtual void update (double deltaTime)
 
nap::EntityInstancegetEntityInstance () const
 
nap::ComponentgetComponent () const
 
template<typename T >
T * getComponent () const
 
virtual bool init (utility::ErrorState &errorState)
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

nap::Signal< const WebSocketConnectionOpenedEvent & > connectionOpened
 
nap::Signal< const WebSocketConnectionClosedEvent & > connectionClosed
 
nap::Signal< const WebSocketConnectionFailedEvent & > connectionFailed
 
nap::Signal< const WebSocketMessageReceivedEvent & > messageReceived
 
- 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)
 

Description

Instance part of the WebSocketComponent, receives web-socket client and server events. Listen to the various signals to receive web-socket events in your application. The events are received on the main application thread. This object ensures thread-safety. Only web-socket events that originated from the given interface (client or server) are accepted.

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

Constructor & Destructor Documentation

◆ WebSocketComponentInstance()

WebSocketComponentInstance ( EntityInstance entity,
Component resource 
)

Constructor.

Parameters
entitythe entity this component belongs to.
resourcethe original nap::WebSocketComponent

◆ ~WebSocketComponentInstance()

virtual ~WebSocketComponentInstance ( )
virtual

Member Function Documentation

◆ getInterface() [1/2]

WebSocketInterface& getInterface ( )
Returns
the client or server this component receives events from.

◆ getInterface() [2/2]

const WebSocketInterface& getInterface ( ) const
Returns
the client or server this component receives events from.

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Initialize this instance of the nap::WebSocketComponent.

Parameters
errorStateholds the error message when initialization fails.
Returns
if the component initialized successfully.

Reimplemented from ComponentInstance.

Member Data Documentation

◆ connectionClosed

nap::Signal<const WebSocketConnectionClosedEvent&> connectionClosed

Occurs when a connection to a client or server is closed.

◆ connectionFailed

nap::Signal<const WebSocketConnectionFailedEvent&> connectionFailed

Occurs when a connection to a client or server failed to establish.

◆ connectionOpened

nap::Signal<const WebSocketConnectionOpenedEvent&> connectionOpened

Occurs when a new connection to a client or server is established.

◆ messageReceived

nap::Signal<const WebSocketMessageReceivedEvent&> messageReceived

Occurs when a new message from a client or server is received.