Orbit Framework
An ultra-modern, asynchronous, cross-platform C++ Web Framework.
Loading...
Searching...
No Matches
websocket::EventRouter< SessionType > Class Template Reference

A Socket.IO style event router for WebSockets with Room and Session support. More...

#include <EventRouter.hpp>

Classes

struct  RoomBroadcaster
 

Public Types

using SocketPtr = std::shared_ptr< EventSocket< SessionType > >
 

Public Member Functions

template<typename PayloadType >
void on (const std::string &event, std::function< void(EventSocket< SessionType > &, const PayloadType &)> handler)
 
void on (const std::string &event, std::function< void(EventSocket< SessionType > &)> handler)
 Registers an untyped event handler (no data expected).
 
void on_connect (std::function< void(EventSocket< SessionType > &)> handler)
 Registers a connection handler.
 
void on_disconnect (std::function< void(EventSocket< SessionType > &)> handler)
 Registers a disconnection handler.
 
void attach (server::App &app, const std::string &path)
 Attaches this EventRouter to the Orbit App at a specific path.
 
RoomBroadcaster to (const std::string &room)
 
void join_room (const std::string &id, const std::string &room)
 
void leave_room (const std::string &id, const std::string &room)
 
void broadcast_to_room (const std::string &room, const std::string &msg)
 

Detailed Description

template<typename SessionType>
class websocket::EventRouter< SessionType >

A Socket.IO style event router for WebSockets with Room and Session support.

Member Typedef Documentation

◆ SocketPtr

Member Function Documentation

◆ attach()

template<typename SessionType >
void websocket::EventRouter< SessionType >::attach ( server::App app,
const std::string &  path 
)
inline

◆ broadcast_to_room()

template<typename SessionType >
void websocket::EventRouter< SessionType >::broadcast_to_room ( const std::string &  room,
const std::string &  msg 
)
inline

◆ join_room()

◆ leave_room()

◆ on() [1/2]

template<typename SessionType >
void websocket::EventRouter< SessionType >::on ( const std::string &  event,
std::function< void(EventSocket< SessionType > &)>  handler 
)
inline

Registers an untyped event handler (no data expected).

◆ on() [2/2]

◆ on_connect()

template<typename SessionType >
void websocket::EventRouter< SessionType >::on_connect ( std::function< void(EventSocket< SessionType > &)>  handler)
inline

◆ on_disconnect()

template<typename SessionType >
void websocket::EventRouter< SessionType >::on_disconnect ( std::function< void(EventSocket< SessionType > &)>  handler)
inline

◆ to()


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