Kagome
Polkadot Runtime Engine in C++17
|
rpc session More...
#include <session.hpp>
Public Types | |
using | Context = RpcContext |
using | Socket = boost::asio::ip::tcp::socket |
using | ErrorCode = boost::system::error_code |
using | Streambuf = boost::asio::streambuf |
using | Timer = boost::asio::steady_timer |
using | Connection = boost::signals2::connection |
using | Duration = Timer::duration |
using | SessionId = uint64_t |
using | OnCloseHandler = std::function< void(SessionId, SessionType)> |
Event handlers. More... | |
Public Member Functions | |
virtual | ~Session ()=default |
virtual void | start ()=0 |
starts listening on socket More... | |
virtual Socket & | socket ()=0 |
void | connectOnRequest (std::function< OnRequestSignature > callback) |
connects on request callback More... | |
void | connectOnCloseHandler (OnCloseHandler &&handler) |
connects on close callback More... | |
void | processRequest (std::string_view request, std::shared_ptr< Session > session) |
process request message More... | |
virtual void | respond (std::string_view message)=0 |
send response message More... | |
void | notifyOnClose (SessionId id, SessionType type) |
makes on close notification to listener More... | |
virtual SessionId | id () const =0 |
method to get id of the session More... | |
virtual SessionType | type () const =0 |
method to get type of the session More... | |
Private Types | |
template<class T > | |
using | Signal = boost::signals2::signal< T > |
using | OnRequestSignature = void(std::string_view, std::shared_ptr< Session > session) |
using | OnRequest = Signal< OnRequestSignature > |
Private Attributes | |
std::function< OnRequestSignature > | on_request_ |
on request callback More... | |
OnCloseHandler | on_close_ |
rpc session
Definition at line 27 of file session.hpp.
using kagome::api::Session::Connection = boost::signals2::connection |
Definition at line 41 of file session.hpp.
Definition at line 36 of file session.hpp.
using kagome::api::Session::Duration = Timer::duration |
Definition at line 42 of file session.hpp.
using kagome::api::Session::ErrorCode = boost::system::error_code |
Definition at line 38 of file session.hpp.
using kagome::api::Session::OnCloseHandler = std::function<void(SessionId, SessionType)> |
Event handlers.
Definition at line 46 of file session.hpp.
|
private |
Definition at line 33 of file session.hpp.
|
private |
Definition at line 32 of file session.hpp.
using kagome::api::Session::SessionId = uint64_t |
Definition at line 43 of file session.hpp.
|
private |
Definition at line 29 of file session.hpp.
using kagome::api::Session::Socket = boost::asio::ip::tcp::socket |
Definition at line 37 of file session.hpp.
using kagome::api::Session::Streambuf = boost::asio::streambuf |
Definition at line 39 of file session.hpp.
using kagome::api::Session::Timer = boost::asio::steady_timer |
Definition at line 40 of file session.hpp.
|
virtualdefault |
|
inline |
connects on close
callback
handler | on close event handler |
Definition at line 69 of file session.hpp.
|
inline |
connects on request
callback
callback | on request callback |
Definition at line 61 of file session.hpp.
|
pure virtual |
method to get id of the session
Implemented in kagome::api::HttpSession, and kagome::api::WsSession.
|
inline |
makes on close
notification to listener
id | session id |
type | type of the closed session |
Definition at line 93 of file session.hpp.
|
inline |
process request message
request | message to process |
Definition at line 77 of file session.hpp.
|
pure virtual |
send response message
message | response message |
Implemented in kagome::api::WsSession, and kagome::api::HttpSession.
|
pure virtual |
Implemented in kagome::api::HttpSession, and kagome::api::WsSession.
|
pure virtual |
starts listening on socket
Implemented in kagome::api::HttpSession, and kagome::api::WsSession.
|
pure virtual |
method to get type of the session
Implemented in kagome::api::HttpSession, and kagome::api::WsSession.
|
private |
Definition at line 111 of file session.hpp.
|
private |
on request
callback
Definition at line 110 of file session.hpp.