Open
Description
The library includes a broadcast
utility, with detailed documentation and motivation here.
However, today that utility only works with the asyncio API of WebSockets.
That leaves users of the sync API with two possibilities, if they want to broadcast a message without risk of blocking the thread if some client's buffer is full:
- Implement
broadcast
by accessing directly thesocket
and the sans-IO API to set the sockets to be non-blocking during the broadcast. (tricky!) - Implement
broadcast
by the way of application-level queues, and per-client threads consuming from the queues (runtime and implementation overhead)
It would be nice if the sync API of this library included a ready-made broadcast utility.