Closed hannesa2 closed 2 years ago
Hi @hannesa2, The signature of the ws_sendframe* functions follows below:
int ws_sendframe_txt(int fd, const char *msg, bool broadcast);
int ws_sendframe_bin(int fd, const char *msg, uint64_t size, bool broadcast);
int ws_sendframe(int fd, const char *msg, uint64_t size, bool broadcast, int type);
where the bool (broadcast) type parameter sends the message to all connected clients when true, and only to fd
if false. I believe your example above does exactly what you want.
However, if you only want to send to a few clients, this has already been discussed here, but in summary, you need to handle this manually (keeping a list of all connected clients), as so far, wsServer do not exports the list of connected clients.
It's a feature I intend to work on.
Hi, I play around with your lib and see, that I can resend the received message to sender only
How to send a message to all (or special) connected clients ? Maybe my question is to general, but I'm a C rooky and maybe there is already such a list of clients ?