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
42#include "web/websocket/server/GroupsManager.h"
44#include "web/websocket/server/SubProtocol.h"
46#ifndef DOXYGEN_SHOULD_SKIP_THIS
67 if (subProtocol->group != group) {
68 const std::string newChannel = subProtocol
->getName() +
"/" + group;
70 groups[newChannel].insert(subProtocol);
72 if (!subProtocol
->group.empty()) {
76 subProtocol
->group = newChannel;
95 std::size_t messageLength,
97 if (
groups.contains(group)) {
99 if (client != excludedClient) {
107 if (
groups.contains(group)) {
109 if (client != excludedClient) {
118 std::size_t messageLength,
120 if (
groups.contains(group)) {
122 if (client != excludedClient) {
135 std::size_t messageLength,
137 if (
groups.contains(group)) {
139 if (client != excludedClient) {
152 std::size_t messageLength,
154 if (
groups.contains(group)) {
156 if (client != excludedClient) {
168 const std::function<
void(
const SubProtocol*)>& sendToClient,
170 if (
groups.contains(group)) {
172 if (client != excludedClient) {
173 sendToClient(client);
void sendMessage(const char *message, std::size_t messageLength) const
void sendMessageEnd(const char *message, std::size_t messageLength) const
void sendMessage(const std::string &message) const
const std::string & getName()
void sendMessageStart(const char *message, std::size_t messageLength) const
void sendMessageFrame(const char *message, std::size_t messageLength) const
std::map< std::string, std::set< SubProtocol * > > groups
static GroupsManager * groupsManager
void sendBroadcast(const std::string &group, const char *message, std::size_t messageLength, const SubProtocol *excludedClient)
static GroupsManager * instance()
void sendBroadcastEnd(const std::string &group, const std::string &message, const SubProtocol *excludedClient)
void sendBroadcastFrame(const std::string &group, const std::string &message, const SubProtocol *excludedClient)
void sendBroadcastStart(const std::string &group, const std::string &message, const SubProtocol *excludedClient)
void forEachClient(const std::string &group, const std::function< void(const SubProtocol *)> &sendToClient, const SubProtocol *excludedClient)
void sendBroadcastStart(const std::string &group, const char *message, std::size_t messageLength, const SubProtocol *excludedClient)
void subscribe(SubProtocol *subProtocol, std::string group="")
void sendBroadcastEnd(const std::string &group, const char *message, std::size_t messageLength, const SubProtocol *excludedClient)
void sendBroadcast(const std::string &group, const std::string &message, const SubProtocol *excludedClient)
void unsubscribe(SubProtocol *subProtocol)
void sendBroadcastFrame(const std::string &group, const char *message, std::size_t messageLength, const SubProtocol *excludedClient)