HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NET_WebSocketAPIRouter Class Reference

#include <NET_WebSocketAPIRouter.h>

Public Types

using Middleware = std::function< void(NET_WebSocketAPIRequest &)>
 

Public Member Functions

bool handle (NET_WebStream *stream, const UT_StringHolder &message)
 Handle an incoming websocket message. More...
 
UT_SharedPtr< NET_WebAPIHandlerfindCmd (const UT_StringHolder &name)
 
void addRequestMiddleware (Middleware middleware)
 
void addResponseMiddleware (Middleware middleware)
 
template<typename... Args>
void registerFunction (const UT_StringRef &name, void(*func)(NET_WebSocketAPIRequest &req, Args...), const NET_WebAPIHandler::ParamArray &parr)
 
template<typename Cls , typename... Args>
void registerFunction (const UT_StringRef &name, void(Cls::*func)(NET_WebSocketAPIRequest &req, Args...), Cls *owner, const NET_WebAPIHandler::ParamArray &parr)
 

Detailed Description

Definition at line 31 of file NET_WebSocketAPIRouter.h.

Member Typedef Documentation

Definition at line 37 of file NET_WebSocketAPIRouter.h.

Member Function Documentation

void NET_WebSocketAPIRouter::addRequestMiddleware ( Middleware  middleware)
inline

Definition at line 48 of file NET_WebSocketAPIRouter.h.

void NET_WebSocketAPIRouter::addResponseMiddleware ( Middleware  middleware)
inline

Definition at line 52 of file NET_WebSocketAPIRouter.h.

UT_SharedPtr<NET_WebAPIHandler> NET_WebSocketAPIRouter::findCmd ( const UT_StringHolder name)
bool NET_WebSocketAPIRouter::handle ( NET_WebStream stream,
const UT_StringHolder message 
)

Handle an incoming websocket message.

Parameters
streamThe webstream the message came from.
messageThe message that was received.
Returns
True if the api function has decided the websocket should close.
template<typename... Args>
void NET_WebSocketAPIRouter::registerFunction ( const UT_StringRef name,
void(*)(NET_WebSocketAPIRequest &req, Args...)  func,
const NET_WebAPIHandler::ParamArray parr 
)
inline

{@ Register a new api function with the router.

Definition at line 60 of file NET_WebSocketAPIRouter.h.

template<typename Cls , typename... Args>
void NET_WebSocketAPIRouter::registerFunction ( const UT_StringRef name,
void(Cls::*)(NET_WebSocketAPIRequest &req, Args...)  func,
Cls *  owner,
const NET_WebAPIHandler::ParamArray parr 
)
inline

Definition at line 74 of file NET_WebSocketAPIRouter.h.


The documentation for this class was generated from the following file: