AsyncConnectionHandler.hpp

This File On Github
Ask A Question

API: latest
module: oatpp-websocket
#include "oatpp-websocket/AsyncConnectionHandler.hpp"

AsyncConnectionHandler

Asynchronous websocket connection handler. Extends oatpp::base::Countable, oatpp::network::server::ConnectionHandler.

namespace oatpp { namespace websocket { 
  class AsyncConnectionHandler : public base::Countable, public network::server::ConnectionHandler {}
}}

Methods

Return Type Name Summary
[none] AsyncConnectionHandler Multiple implementations:
  1. Constructor. With threadCount.
  2. Constructor. With oatpp::async::Executor.
std::shared_ptr<AsyncConnectionHandler> createShared Multiple implementations:
  1. Create shared AsyncConnectionHandler with threadCount.
  2. Create shared AsyncConnectionHandler with oatpp::async::Executor.
void setSocketInstanceListener Set AsyncConnectionHandler::SocketInstanceListener.
void handleConnection Implementation of oatpp::network::server::ConnectionHandler::handleConnection().
void stop Will call oatpp::async::Executor::stop().

AsyncConnectionHandler::AsyncConnectionHandler

  1. Constructor. With threadCount. Will create oatpp::async::Executor.
    AsyncConnectionHandler(v_int32 threadCount = oatpp::async::Executor::VALUE_SUGGESTED)
    
  2. Constructor. With oatpp::async::Executor.
    AsyncConnectionHandler(const std::shared_ptr<oatpp::async::Executor>& executor)
    

AsyncConnectionHandler::createShared

  1. Create shared AsyncConnectionHandler with threadCount.
    • @param threadCount - number of threads for oatpp::async::Executor.
    • @return - std::shared_ptr to AsyncConnectionHandler.
    static std::shared_ptr<AsyncConnectionHandler> createShared(v_int32 threadCount = oatpp::async::Executor::VALUE_SUGGESTED)
    
  2. Create shared AsyncConnectionHandler with oatpp::async::Executor.
    static std::shared_ptr<AsyncConnectionHandler> createShared(const std::shared_ptr<oatpp::async::Executor>& executor)
    

AsyncConnectionHandler::setSocketInstanceListener

Set AsyncConnectionHandler::SocketInstanceListener.

void setSocketInstanceListener(const std::shared_ptr<SocketInstanceListener>& listener)

AsyncConnectionHandler::handleConnection

Implementation of oatpp::network::server::ConnectionHandler::handleConnection().

void handleConnection(const std::shared_ptr<IOStream>& connection, const std::shared_ptr<const ParameterMap>& params) override

AsyncConnectionHandler::stop

Will call oatpp::async::Executor::stop().

void stop() override

AsyncConnectionHandler::SocketInstanceListener

Listener for new websocket instances.

namespace oatpp { namespace websocket { 
  class AsyncConnectionHandler : public base::Countable, public network::server::ConnectionHandler {
    class SocketInstanceListener {}
  };
}}

Typedefs

Type Name Summary
oatpp::websocket::AsyncWebSocket AsyncWebSocket Convenience typedef for oatpp::websocket::AsyncWebSocket.
oatpp::network::server::ConnectionHandler::ParameterMap ParameterMap Convenience typedef for oatpp::network::server::ConnectionHandler::ParameterMap.

Methods

Return Type Name Summary
[none] ~SocketInstanceListener Default virtual destructor.
void onAfterCreate_NonBlocking Called when socket is created.
void onBeforeDestroy_NonBlocking Called before socket instance is destroyed.

AsyncConnectionHandler::SocketInstanceListener::AsyncWebSocket

Convenience typedef for oatpp::websocket::AsyncWebSocket.

typedef oatpp::websocket::AsyncWebSocket AsyncWebSocket

AsyncConnectionHandler::SocketInstanceListener::ParameterMap

Convenience typedef for oatpp::network::server::ConnectionHandler::ParameterMap.

typedef oatpp::network::server::ConnectionHandler::ParameterMap ParameterMap

AsyncConnectionHandler::SocketInstanceListener::~SocketInstanceListener

Default virtual destructor.

virtual ~SocketInstanceListener() = default

AsyncConnectionHandler::SocketInstanceListener::onAfterCreate_NonBlocking

Called when socket is created.
This method should not block.

virtual void onAfterCreate_NonBlocking(const std::shared_ptr<AsyncWebSocket>& socket, const std::shared_ptr<const ParameterMap>& params) = 0

AsyncConnectionHandler::SocketInstanceListener::onBeforeDestroy_NonBlocking

Called before socket instance is destroyed.
This method should not block.

virtual void onBeforeDestroy_NonBlocking(const std::shared_ptr<AsyncWebSocket>& socket) = 0