Closed dshahrokhian closed 7 years ago
I never really tried this before, but it seems that websocketpp is thread safe. So you probably can spawn a thread that runs
for (const wspp_connection& c : users) rclient(c).message(your_message);
(see the definition of rclient here: https://github.com/matt-42/silicon/blob/master/examples/ws_broadcast_server.cc)
whenever you need to.
Thank you Matthieu, I was wondering if there was any way to call _broadcast
, instead of duplicating code, but still works I guess.
Is there any way in which through the example
ws_broadcast_server.cc
the server can trigger a broadcast to all clients, without the need of a client sending a message?