SNode.C
Loading...
Searching...
No Matches
web::websocket::server::SubProtocol Class Reference

#include <SubProtocol.h>

Inheritance diagram for web::websocket::server::SubProtocol:
Collaboration diagram for web::websocket::server::SubProtocol:

Public Member Functions

 ~SubProtocol () override
void subscribe (const std::string &group)
void sendBroadcast (const char *message, std::size_t messageLength, bool excludeSelf=false)
void sendBroadcast (const std::string &message, bool excludeSelf=false)
void sendBroadcastStart (const char *message, std::size_t messageLength, bool excludeSelf=false)
void sendBroadcastStart (const std::string &message, bool excludeSelf=false)
void sendBroadcastFrame (const char *message, std::size_t messageLength, bool excludeSelf=false)
void sendBroadcastFrame (const std::string &message, bool excludeSelf=false)
void sendBroadcastEnd (const char *message, std::size_t messageLength, bool excludeSelf=false)
void sendBroadcastEnd (const std::string &message, bool excludeSelf=false)
void forEachClient (const std::function< void(const SubProtocol *)> &sendToClient, bool excludeSelf=false)
void sendMessage (const char *message, std::size_t messageLength) const
void sendMessage (const std::string &message) const
void sendMessageEnd (const char *message, std::size_t messageLength) const
void sendMessageEnd (const std::string &message) const
void sendMessageFrame (const char *message, std::size_t messageLength) const
void sendMessageFrame (const std::string &message) const
void sendMessageStart (const char *message, std::size_t messageLength) const
void sendMessageStart (const std::string &message) const
void sendClose (uint16_t statusCode=1000, const char *reason=nullptr, std::size_t reasonLength=0)
Public Member Functions inherited from web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >
 SubProtocol (SubProtocol &)=delete
 SubProtocol (SubProtocol &&)=delete
SubProtocoloperator= (SubProtocol &)=delete
SubProtocoloperator= (SubProtocol &&)=delete
void sendMessage (const char *message, std::size_t messageLength) const
void sendMessage (const std::string &message) const
void sendMessageStart (const char *message, std::size_t messageLength) const
void sendMessageStart (const std::string &message) const
void sendMessageFrame (const char *message, std::size_t messageLength) const
void sendMessageFrame (const std::string &message) const
void sendMessageEnd (const char *message, std::size_t messageLength) const
void sendMessageEnd (const std::string &message) const
void sendPing (const char *reason=nullptr, std::size_t reasonLength=0) const
void sendClose (uint16_t statusCode=1000, const char *reason=nullptr, std::size_t reasonLength=0)
const std::string & getName ()
core::socket::stream::SocketConnectiongetSocketConnection () const
std::size_t getPayloadTotalSent () const
std::size_t getPayloadTotalRead () const
std::string getOnlineSince () const
std::string getOnlineDuration () const

Protected Member Functions

 SubProtocol (SubProtocolContext *subProtocolContext, const std::string &name, int pingInterval=0, int maxFlyingPings=3)
Protected Member Functions inherited from web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >
 SubProtocol (SubProtocolContext *subProtocolContext, const std::string &name, int pingInterval=60, int maxFlyingPings=3)

Private Types

using Super = web::websocket::SubProtocol<web::websocket::server::SocketContextUpgrade>

Private Attributes

std::string group

Friends

template<typename RequestT, typename ResponseT, typename SubProtocolT>
class web::websocket::SocketContextUpgrade
class GroupsManager

Additional Inherited Members

Protected Attributes inherited from web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >
SubProtocolContextsubProtocolContext

Detailed Description

Definition at line 63 of file SubProtocol.h.

Member Typedef Documentation

◆ Super

Constructor & Destructor Documentation

◆ SubProtocol()

web::websocket::server::SubProtocol::SubProtocol ( SubProtocolContext * subProtocolContext,
const std::string & name,
int pingInterval = 0,
int maxFlyingPings = 3 )
protected

Definition at line 53 of file SubProtocol.cpp.

54 : Super(subProtocolContext, name, pingInterval, maxFlyingPings) {
56 }
void subscribe(SubProtocol *subProtocol, std::string group="")
web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade > Super
Definition SubProtocol.h:65

References web::websocket::server::GroupsManager::instance(), web::websocket::SubProtocol< SocketContextUpgradeT >::SubProtocol(), and web::websocket::server::GroupsManager::subscribe().

Referenced by apps::websocket::subprotocol::echo::server::Echo::Echo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~SubProtocol()

web::websocket::server::SubProtocol::~SubProtocol ( )
overridevirtual

Reimplemented from web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >.

Reimplemented in iot::mqtt::SubProtocol< web::websocket::server::SubProtocol >.

Definition at line 58 of file SubProtocol.cpp.

58 {
60 }
void unsubscribe(SubProtocol *subProtocol)

References web::websocket::server::GroupsManager::instance(), and web::websocket::server::GroupsManager::unsubscribe().

Here is the call graph for this function:

Member Function Documentation

◆ forEachClient()

void web::websocket::server::SubProtocol::forEachClient ( const std::function< void(const SubProtocol *)> & sendToClient,
bool excludeSelf = false )

Definition at line 101 of file SubProtocol.cpp.

101 {
102 GroupsManager::instance()->forEachClient(group, sendToClient, excludeSelf ? this : nullptr);
103 }
void forEachClient(const std::string &group, const std::function< void(const SubProtocol *)> &sendToClient, const SubProtocol *excludedClient)

References web::websocket::server::GroupsManager::forEachClient(), group, and web::websocket::server::GroupsManager::instance().

Here is the call graph for this function:

◆ sendBroadcast() [1/2]

void web::websocket::server::SubProtocol::sendBroadcast ( const char * message,
std::size_t messageLength,
bool excludeSelf = false )

Definition at line 73 of file SubProtocol.cpp.

73 {
74 GroupsManager::instance()->sendBroadcast(group, message, messageLength, excludeSelf ? this : nullptr);
75 }
void sendBroadcast(const std::string &group, const char *message, std::size_t messageLength, const SubProtocol *excludedClient)

References group, web::websocket::server::GroupsManager::instance(), and web::websocket::server::GroupsManager::sendBroadcast().

Here is the call graph for this function:

◆ sendBroadcast() [2/2]

void web::websocket::server::SubProtocol::sendBroadcast ( const std::string & message,
bool excludeSelf = false )

Definition at line 69 of file SubProtocol.cpp.

69 {
70 GroupsManager::instance()->sendBroadcast(group, message, excludeSelf ? this : nullptr);
71 }

References group, web::websocket::server::GroupsManager::instance(), and web::websocket::server::GroupsManager::sendBroadcast().

Referenced by apps::websocket::subprotocol::echo::server::Echo::onMessageEnd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendBroadcastEnd() [1/2]

void web::websocket::server::SubProtocol::sendBroadcastEnd ( const char * message,
std::size_t messageLength,
bool excludeSelf = false )

Definition at line 93 of file SubProtocol.cpp.

93 {
94 GroupsManager::instance()->sendBroadcastEnd(group, message, messageLength, excludeSelf ? this : nullptr);
95 }
void sendBroadcastEnd(const std::string &group, const char *message, std::size_t messageLength, const SubProtocol *excludedClient)

References group, web::websocket::server::GroupsManager::instance(), and web::websocket::server::GroupsManager::sendBroadcastEnd().

Here is the call graph for this function:

◆ sendBroadcastEnd() [2/2]

void web::websocket::server::SubProtocol::sendBroadcastEnd ( const std::string & message,
bool excludeSelf = false )

Definition at line 97 of file SubProtocol.cpp.

97 {
98 GroupsManager::instance()->sendBroadcastEnd(group, message.data(), message.length(), excludeSelf ? this : nullptr);
99 }

References group, web::websocket::server::GroupsManager::instance(), and web::websocket::server::GroupsManager::sendBroadcastEnd().

Here is the call graph for this function:

◆ sendBroadcastFrame() [1/2]

void web::websocket::server::SubProtocol::sendBroadcastFrame ( const char * message,
std::size_t messageLength,
bool excludeSelf = false )

Definition at line 85 of file SubProtocol.cpp.

85 {
86 GroupsManager::instance()->sendBroadcastFrame(group, message, messageLength, excludeSelf ? this : nullptr);
87 }
void sendBroadcastFrame(const std::string &group, const char *message, std::size_t messageLength, const SubProtocol *excludedClient)

References group, web::websocket::server::GroupsManager::instance(), and web::websocket::server::GroupsManager::sendBroadcastFrame().

Here is the call graph for this function:

◆ sendBroadcastFrame() [2/2]

void web::websocket::server::SubProtocol::sendBroadcastFrame ( const std::string & message,
bool excludeSelf = false )

Definition at line 89 of file SubProtocol.cpp.

89 {
90 GroupsManager::instance()->sendBroadcastFrame(group, message.data(), message.length(), excludeSelf ? this : nullptr);
91 }

References group, web::websocket::server::GroupsManager::instance(), and web::websocket::server::GroupsManager::sendBroadcastFrame().

Here is the call graph for this function:

◆ sendBroadcastStart() [1/2]

void web::websocket::server::SubProtocol::sendBroadcastStart ( const char * message,
std::size_t messageLength,
bool excludeSelf = false )

Definition at line 77 of file SubProtocol.cpp.

77 {
78 GroupsManager::instance()->sendBroadcastStart(group, message, messageLength, excludeSelf ? this : nullptr);
79 }
void sendBroadcastStart(const std::string &group, const char *message, std::size_t messageLength, const SubProtocol *excludedClient)

References group, web::websocket::server::GroupsManager::instance(), and web::websocket::server::GroupsManager::sendBroadcastStart().

Here is the call graph for this function:

◆ sendBroadcastStart() [2/2]

void web::websocket::server::SubProtocol::sendBroadcastStart ( const std::string & message,
bool excludeSelf = false )

Definition at line 81 of file SubProtocol.cpp.

81 {
82 GroupsManager::instance()->sendBroadcastStart(group, message, excludeSelf ? this : nullptr);
83 }

References group, web::websocket::server::GroupsManager::instance(), and web::websocket::server::GroupsManager::sendBroadcastStart().

Here is the call graph for this function:

◆ sendClose()

void web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >::sendClose ( uint16_t statusCode = 1000,
const char * reason = nullptr,
std::size_t reasonLength = 0 )

◆ sendMessage() [1/2]

void web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >::sendMessage ( const char * message,
std::size_t messageLength ) const

◆ sendMessage() [2/2]

void web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >::sendMessage ( const std::string & message) const

◆ sendMessageEnd() [1/2]

void web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >::sendMessageEnd ( const char * message,
std::size_t messageLength ) const

◆ sendMessageEnd() [2/2]

void web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >::sendMessageEnd ( const std::string & message) const

◆ sendMessageFrame() [1/2]

void web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >::sendMessageFrame ( const char * message,
std::size_t messageLength ) const

◆ sendMessageFrame() [2/2]

void web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >::sendMessageFrame ( const std::string & message) const

◆ sendMessageStart() [1/2]

void web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >::sendMessageStart ( const char * message,
std::size_t messageLength ) const

◆ sendMessageStart() [2/2]

void web::websocket::SubProtocol< web::websocket::server::SocketContextUpgrade >::sendMessageStart ( const std::string & message) const

◆ subscribe()

void web::websocket::server::SubProtocol::subscribe ( const std::string & group)

Definition at line 62 of file SubProtocol.cpp.

62 {
64 // subscibe(group, this);
65 // unsubscribe(this->group, this);
66 // this->group = group;
67 }

References web::websocket::server::GroupsManager::instance(), and web::websocket::server::GroupsManager::subscribe().

Here is the call graph for this function:

◆ GroupsManager

friend class GroupsManager
friend

Definition at line 104 of file SubProtocol.h.

◆ web::websocket::SocketContextUpgrade

template<typename RequestT, typename ResponseT, typename SubProtocolT>
friend class web::websocket::SocketContextUpgrade
friend

Definition at line 102 of file SubProtocol.h.

Member Data Documentation

◆ group


The documentation for this class was generated from the following files: