1#ifndef COMMUNICATION_GROUP_SERVER_H
2#define COMMUNICATION_GROUP_SERVER_H
18 using ResponseHandler = std::function<void(uint32_t, R)>;
23 template <
typename T,
typename R>
27 ResponseHandler<R> mResponseHandler;
28 std::vector<uint32_t> mClients;
48 std::future<
void>
Message(uint32_t clientID, const T &msg) const;
53 void Response(uint32_t clientID, const R &responseMsg)
55 mResponseHandler(clientID, responseMsg);
Communication group server skeleton.
Definition: communication_group_server.h:25
std::future< void > Message(uint32_t clientID, const T &msg) const
Send a request message to a specific client.
CommunicationGroupServer(ResponseHandler< R > responseHandler)
Constructor.
Definition: communication_group_server.h:33
std::future< std::vector< uint32_t > > ListClients() const
List all the subscribed clients.
std::future< void > Broadcast(const T &msg) const
Broadcast a request message to all the clients.
void Response(uint32_t clientID, const R &responseMsg)
Receive a response message from a client.
Definition: communication_group_server.h:53