2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
44#ifndef DOXYGEN_SHOULD_SKIP_THIS
46#include "log/Logger.h"
47#include "utils/system/signal.h"
53#define MAX_FLYING_PINGS 3
54#define PING_INTERVAL 90
56namespace apps::websocket::subprotocol::echo::
server {
63 VLOG(1) <<
"Echo connected";
70 VLOG(2) <<
"Message Start - OpCode: " << opCode;
74 data += std::string(chunk, chunkLen);
76 VLOG(2) <<
"Message Fragment: " << std::string(chunk, chunkLen);
80 VLOG(1) <<
"Message Data: " <<
data;
82
83
84
85
92 VLOG(1) <<
"Message error: " << errnum;
96 VLOG(1) <<
"Echo disconnected:";
100 VLOG(1) <<
"SubProtocol 'echo' exit due to '" << strsignal(sig) <<
"' (SIG" << utils
::system::sigabbrev_np(sig
) <<
" = " << sig
bool onSignal(int sig) override
Echo(web::websocket::SubProtocolContext *socketContextUpgradeBase, const std::string &name)
void onDisconnected() override
void onMessageError(uint16_t errnum) override
void onMessageStart(int opCode) override
void onMessageData(const char *chunk, std::size_t chunkLen) override
void onMessageEnd() override
void onConnected() override
void sendMessage(const std::string &message) const
void sendClose(uint16_t statusCode=1000, const char *reason=nullptr, std::size_t reasonLength=0)
SubProtocol(SubProtocolContext *subProtocolContext, const std::string &name, int pingInterval=0, int maxFlyingPings=3)
void sendBroadcast(const std::string &message, bool excludeSelf=false)
std::string sigabbrev_np(int sig)