sgns::api::Session¶
rpc session
#include <session.hpp>
Inherited by sgns::api::HttpSession, sgns::api::WsSession
Public Types¶
| 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¶
| Name | |
|---|---|
| virtual | ~Session() =default |
| virtual void | start() =0 starts listening on socket |
| virtual Socket & | socket() =0 |
| 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 |
| virtual void | respond(std::string_view message) =0 send response message |
| void | notifyOnClose(SessionId id, SessionType type) makes on close notification to listener |
| virtual SessionId | id() const =0 method to get id of the session |
| virtual SessionType | type() const =0 method to get type of the session |
Public Types Documentation¶
using Context¶
using Socket¶
using ErrorCode¶
using Streambuf¶
using Timer¶
using Connection¶
using Duration¶
using SessionId¶
using OnCloseHandler¶
Event handlers.
Public Functions Documentation¶
function ~Session¶
function start¶
starts listening on socket
Reimplemented by: sgns::api::HttpSession::start, sgns::api::WsSession::start
function socket¶
Reimplemented by: sgns::api::HttpSession::socket, sgns::api::WsSession::socket
function connectOnRequest¶
connects on request callback
Parameters:
- callback
on requestcallback
function connectOnCloseHandler¶
connects on close callback
Parameters:
- handler
on closeevent handler
function processRequest¶
process request message
Parameters:
- request message to process
- session session instance
function respond¶
send response message
Parameters:
- message response message
Reimplemented by: sgns::api::HttpSession::respond, sgns::api::WsSession::respond
function notifyOnClose¶
makes on close notification to listener
Parameters:
function id¶
method to get id of the session
Return: id of the session
Reimplemented by: sgns::api::HttpSession::id, sgns::api::WsSession::id
function type¶
method to get type of the session
Return: type of the session
Reimplemented by: sgns::api::HttpSession::type, sgns::api::WsSession::type
Updated on 2026-03-04 at 13:10:43 -0800