sgns::api::Listener¶
server which listens for incoming connection, accepts connections making session from socket
#include <listener.hpp>
Inherits from IComponent
Inherited by sgns::api::HttpListenerImpl, sgns::api::WsListenerImpl
Public Classes¶
| Name | |
|---|---|
| struct | Configuration |
Public Types¶
| Name | |
|---|---|
| using RpcContext | Context |
Protected Types¶
| Name | |
|---|---|
| using boost::asio::ip::tcp::acceptor | Acceptor |
| using boost::asio::ip::tcp::endpoint | Endpoint |
| using std::function< void(const std::shared_ptr< Session > &)> | NewSessionHandler |
Public Functions¶
| Name | |
|---|---|
| ~Listener() override =default | |
| virtual bool | prepare() =0 Bind endpoint. |
| virtual bool | start() =0 Start handling inner connection. |
| virtual void | stop() =0 Stop working. |
| virtual void | setHandlerForNewSession(NewSessionHandler && on_new_session) =0 Set handler for working new session. |
Protected Functions¶
| Name | |
|---|---|
| virtual void | acceptOnce() =0 Accept incoming connection. |
Additional inherited members¶
Public Functions inherited from IComponent
| Name | |
|---|---|
| virtual | ~IComponent() =default |
| virtual std::string | GetName() =0 |
Public Types Documentation¶
using Context¶
Protected Types Documentation¶
using Acceptor¶
using Endpoint¶
using NewSessionHandler¶
using sgns::api::Listener::NewSessionHandler =
std::function<void(const std::shared_ptr<Session> &)>;
Public Functions Documentation¶
function ~Listener¶
function prepare¶
Bind endpoint.
See: AppStateManager::takeControl
Reimplemented by: sgns::api::HttpListenerImpl::prepare, sgns::api::WsListenerImpl::prepare
function start¶
Start handling inner connection.
See: AppStateManager::takeControl
Reimplemented by: sgns::api::HttpListenerImpl::start, sgns::api::WsListenerImpl::start
function stop¶
Stop working.
See: AppStateManager::takeControl
Reimplemented by: sgns::api::HttpListenerImpl::stop, sgns::api::WsListenerImpl::stop
function setHandlerForNewSession¶
Set handler for working new session.
Reimplemented by: sgns::api::HttpListenerImpl::setHandlerForNewSession, sgns::api::WsListenerImpl::setHandlerForNewSession
Protected Functions Documentation¶
function acceptOnce¶
Accept incoming connection.
Reimplemented by: sgns::api::HttpListenerImpl::acceptOnce, sgns::api::WsListenerImpl::acceptOnce
Updated on 2026-03-04 at 13:10:43 -0800