Skip to content

sgns::api::WsSession

#include <ws_session.hpp>

Inherits from sgns::api::Session, std::enable_shared_from_this< WsSession >

Public Classes

Name
struct Configuration

Public Functions

Name
~WsSession() override =default
WsSession(Context & context, Configuration config, SessionId id)
constructor
virtual Socket & socket() override
virtual void start() override
starts session
virtual Session::SessionId id() const override
method to get id of the session
virtual SessionType type() const override
method to get type of the session
virtual void respond(std::string_view response) override
sends response wrapped by websocket frame

Additional inherited members

Public Types inherited from sgns::api::Session

Name
using RpcContext Context
using boost::asio::ip::tcp::socket Socket
using boost::system::error_code ErrorCode
using boost::asio::streambuf Streambuf
using boost::asio::steady_timer Timer
using boost::signals2::connection Connection
using Timer::duration Duration
using uint64_t SessionId
using std::function< void(SessionId, SessionType)> OnCloseHandler
Event handlers.

Public Functions inherited from sgns::api::Session

Name
virtual ~Session() =default
void connectOnRequest(std::function< OnRequestSignature > callback)
connects on request callback
void connectOnCloseHandler(OnCloseHandler && handler)
connects on close callback
void processRequest(std::string_view request, std::shared_ptr< Session > session)
process request message
void notifyOnClose(SessionId id, SessionType type)
makes on close notification to listener

Public Functions Documentation

function ~WsSession

~WsSession() override =default

function WsSession

WsSession(
    Context & context,
    Configuration config,
    SessionId id
)

constructor

Parameters:

  • context context of session
  • config session configuration
  • id session id

function socket

inline virtual Socket & socket() override

Reimplements: sgns::api::Session::socket

function start

virtual void start() override

starts session

Reimplements: sgns::api::Session::start

function id

virtual Session::SessionId id() const override

method to get id of the session

Return: id of the session

Reimplements: sgns::api::Session::id

function type

inline virtual SessionType type() const override

method to get type of the session

Return: type of the session

Reimplements: sgns::api::Session::type

function respond

virtual void respond(
    std::string_view response
) override

sends response wrapped by websocket frame

Parameters:

  • response message to send

Reimplements: sgns::api::Session::respond


Updated on 2026-03-04 at 13:10:43 -0800