NAP
Public Member Functions | List of all members
APIWebSocketEvent Class Reference

#include <apiwebsocketevent.h>

Public Member Functions

 APIWebSocketEvent (const std::string &name, const WebSocketConnection &connection, WebSocketInterface &wsInterface)
 
 APIWebSocketEvent (std::string &&name, const WebSocketConnection &connection, WebSocketInterface &wsInterface)
 
 APIWebSocketEvent (const std::string &name, const std::string &id, const WebSocketConnection &connection, WebSocketInterface &wsInterface)
 
 APIWebSocketEvent (std::string &&name, std::string &&id, const WebSocketConnection &connection, WebSocketInterface &wsInterface)
 
const WebSocketConnectiongetConnection () const
 
WebSocketInterfacegetInterface ()
 
const WebSocketInterfacegetInterface () const
 
- Public Member Functions inherited from APIEvent
 APIEvent (const std::string &name)
 
 APIEvent (std::string &&name)
 
 APIEvent (const std::string &name, const std::string &id)
 
 APIEvent (std::string &&name, std::string &&id)
 
const std::string & getName () const
 
const std::string & getID () const
 
template<typename T , typename... Args>
APIArgumentaddArgument (const std::string &name, Args &&... args)
 
APIArgumentaddArgument (std::unique_ptr< APIBaseValue > value)
 
int getCount () const
 
const ArgumentConstIterator getArguments () const
 
const APIArgumentgetArgument (int index) const
 
APIArgumentgetArgument (int index)
 
const APIArgumentgetArgumentByName (std::string &&name) const
 
APIArgumentgetArgumentByName (std::string &&name)
 
bool matches (const nap::APISignature &signature) const
 
template<typename T >
const T & to () const
 
template<typename T >
T & to ()
 
APIArgumentoperator[] (std::size_t idx)
 
const APIArgumentoperator[] (std::size_t idx) const
 
- Public Member Functions inherited from Event
virtual ~Event ()=default
 
 Event ()=default
 
 Event (const Event &)=delete
 
Eventoperator= (const Event &)=delete
 

Additional Inherited Members

- Public Types inherited from APIEvent
using ArgumentConstIterator = utility::UniquePtrConstVectorWrapper< APIArgumentList, APIArgument * >
 
Inheritance diagram for APIWebSocketEvent:
[legend]
Collaboration diagram for APIWebSocketEvent:
[legend]

Constructor & Destructor Documentation

◆ APIWebSocketEvent() [1/4]

APIWebSocketEvent ( const std::string &  name,
const WebSocketConnection connection,
WebSocketInterface wsInterface 
)

Constructs a new web socket event with the given name and web-socket connection. A unique id is generated for this event.

Parameters
namethe name of this call
connectionthe web-socket endpoint connection.
wsInterfaceinterface this event originated from (client or server)

◆ APIWebSocketEvent() [2/4]

APIWebSocketEvent ( std::string &&  name,
const WebSocketConnection connection,
WebSocketInterface wsInterface 
)

Constructs a new web socket event with the given name and web-socket connection. A unique id is generated for this event.

Parameters
namethe name of this call
connectionthe web-socket endpoint connection.
wsInterfaceinterface this event originated from (client or server)

◆ APIWebSocketEvent() [3/4]

APIWebSocketEvent ( const std::string &  name,
const std::string &  id,
const WebSocketConnection connection,
WebSocketInterface wsInterface 
)

Constructs a new web socket event with the given name, unique id and web-socket connection. Use this constructor to form a reply based on a previously received client request. The uuid should match the uuid of the request. This allows the client to match call id's.

Parameters
namethe name of this call
idunique identifier of this call
connectionthe web-socket endpoint connection.
wsInterfaceinterface this event originated from (client or server)

◆ APIWebSocketEvent() [4/4]

APIWebSocketEvent ( std::string &&  name,
std::string &&  id,
const WebSocketConnection connection,
WebSocketInterface wsInterface 
)

Constructs a new web socket event with the given name, unique id and web-socket connection. Use this constructor to form a reply based on a previously received client request. The uuid should match the uuid of the request. This allows the client to match call id's.

Parameters
namethe name of this call
idunique identifier of this call
connectionthe web-socket endpoint connection.
wsInterfaceinterface this event originated from (client or server)

Member Function Documentation

◆ getConnection()

const WebSocketConnection& getConnection ( ) const
Returns
The web-socket connection associated with this event

◆ getInterface() [1/2]

WebSocketInterface& getInterface ( )

Returns the interface that created this web-socket event. The interface is either an api server or client of type: APIWebSocketClient or APIWebSocketServer.

Returns
The web-socket interface associated with this event.

◆ getInterface() [2/2]

const WebSocketInterface& getInterface ( ) const

Returns the interface that created this web-socket event. The interface is either an api server or client of type: APIWebSocketClient or APIWebSocketServer.

Returns
The web-socket interface associated with this event.