Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
orbit::websocket::EventSocket< SessionType > Class Template Reference

Represents a connected client in the EventRouter. More...

#include <EventRouter.hpp>

Collaboration diagram for orbit::websocket::EventSocket< SessionType >:

Public Member Functions

 EventSocket (http::websocket::WebSocketConnection &raw, EventRouter< SessionType > &router, std::string id)
 
template<typename T >
void emit (const std::string &event, const T &data)
 Emits an event with strongly-typed data back to this specific client.
 
void join (const std::string &room)
 Joins a specific room/channel.
 
void leave (const std::string &room)
 Leaves a specific room/channel.
 
auto to (const std::string &room)
 Returns a broadcaster to emit messages to everyone in the room.
 
SessionType & session ()
 The strongly-typed session state attached to this connection.
 
const std::string & id () const
 
http::websocket::WebSocketConnection & raw ()
 

Private Attributes

http::websocket::WebSocketConnection & raw_
 
EventRouter< SessionType > & router_
 
std::string id_
 
SessionType session_
 
std::unordered_set< std::string > rooms_
 

Friends

class EventRouter< SessionType >
 

Detailed Description

template<typename SessionType>
class orbit::websocket::EventSocket< SessionType >

Represents a connected client in the EventRouter.

Constructor & Destructor Documentation

◆ EventSocket()

template<typename SessionType >
orbit::websocket::EventSocket< SessionType >::EventSocket ( http::websocket::WebSocketConnection &  raw,
EventRouter< SessionType > &  router,
std::string  id 
)
inline

Member Function Documentation

◆ emit()

template<typename SessionType >
template<typename T >
void orbit::websocket::EventSocket< SessionType >::emit ( const std::string &  event,
const T &  data 
)
inline

Emits an event with strongly-typed data back to this specific client.

Examples
/home/runner/work/orbit-framework/orbit-framework/include/orbit/websocket/EventRouter.hpp.

◆ id()

◆ join()

◆ leave()

◆ raw()

◆ session()

The strongly-typed session state attached to this connection.

Examples
/home/runner/work/orbit-framework/orbit-framework/include/orbit/websocket/EventRouter.hpp.

◆ to()

template<typename SessionType >
auto orbit::websocket::EventSocket< SessionType >::to ( const std::string &  room)

Returns a broadcaster to emit messages to everyone in the room.

Examples
/home/runner/work/orbit-framework/orbit-framework/include/orbit/websocket/EventRouter.hpp.

Friends And Related Symbol Documentation

◆ EventRouter< SessionType >

Member Data Documentation

◆ id_

◆ raw_

◆ rooms_

◆ router_

◆ session_


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