[Libwebsockets] Removing broadcast
"Andy Green (林安廸)"
andy at warmcat.com
Tue Jan 29 15:39:00 CET 2013
I added the broadcast-related apis in 2010, along later with some code
using internal sockets to serialize broadcasts from other threads.
As time has gone on I realized that's not really workable, and gives the
impression one can use libwebsocket apis in a thread / fork safe way
randomly, which you can't.
I just pushed this patch
which removes everything "broadcast" related, replacing it with
libwebsocket_callback_on_writable_all_protoco() in the test server.
Likewise forked service loop support is removed along with some other
small related things, and the documentation updated.
Sorry about any impact on existing code, but it's clear that holding wsi
pointers outside the (single threaded) callback is actually unsafe,
since the wsi may close and be freed at any time. Conversely, the
callback can only be called with live wsi pointers.
Instead, the code using the library needs to be arranged to do the
library service calls from the same thread that created the context, and
only perform wsi-related operations from the callback.
More information about the Libwebsockets