ConnectionHandler.hpp

This File On Github
Ask A Question

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

ConnectionHandler

Websocket connection handler. Extends oatpp::network::server::ConnectionHandler.
Will create one thread per each connection to handle communication.

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

Methods

Return Type Name Summary
[none] ConnectionHandler Constructor.
std::shared_ptr<ConnectionHandler> createShared Create shared ConnectionHandler.
void setSocketInstanceListener Set socket instance listener.
void handleConnection Implementation of oatpp::network::server::ConnectionHandler::handleConnection().
void stop Implementation of oatpp::network::server::ConnectionHandler::stop().

ConnectionHandler::ConnectionHandler

Constructor.

ConnectionHandler()

ConnectionHandler::createShared

Create shared ConnectionHandler.

  • @return - std::shared_ptr to ConnectionHandler.

static std::shared_ptr<ConnectionHandler> createShared()

ConnectionHandler::setSocketInstanceListener

Set socket instance listener.

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

ConnectionHandler::handleConnection

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

void handleConnection(const std::shared_ptr<oatpp::data::stream::IOStream>& connection) override

ConnectionHandler::stop

Implementation of oatpp::network::server::ConnectionHandler::stop(). Here does nothing.

void stop() override

ConnectionHandler::SocketInstanceListener

Listener for new websocket instances.

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

Methods

Return Type Name Summary
void onAfterCreate Called when socket is created
void onBeforeDestroy Called before socket instance is destroyed.

ConnectionHandler::SocketInstanceListener::onAfterCreate

Called when socket is created

virtual void onAfterCreate(const WebSocket& socket) = 0

ConnectionHandler::SocketInstanceListener::onBeforeDestroy

Called before socket instance is destroyed.

virtual void onBeforeDestroy(const WebSocket& socket) = 0