Closed alexe100 closed 4 years ago
That's what the *_user_data
are for, they are app driven pointers that you can use to pass any data you want. Typically in your case you can use those pointers to pass a database handler, a shared structure or a structure. You can check the websocket management in Taliesin to get an idea: https://github.com/babelouest/taliesin/blob/master/src/webservice.c
Since all websocket instances are in a separated thread, you need to be careful with the concurrent memory access, that's why I use mutexes and cond.
Great! Thank you
Hi! I am trying to plan a system that includes one or more web browsers, one websocket_server instance and one websocket_client. When websocket_client sends a message to the websocket_server, I would like to echo that message to all browser connection "instances". In this case, in the websocket_server websocket_incoming_message_callback I need to get message (last_message->data) from websocket_client and, by hand, write that message to all browsers endpoint connections, right?
If we have just one websocket endpoint on the websocket_server, where can I get the the list of browsers websocket connections endpoints in order to echo messages to all of them? Is there any sample that does this?
Thank you Alex