python-websocketd
Python module for creating a http server which uses WebSockets.

◆ broadcast

websocketd.RPChttpd.broadcast

Function to send an event to some or all connected clients.

To send to some clients, add an identifier to all clients in a group, and use that identifier in the item operator, like so:

connection0.groups.clear()
connection1.groups.add('foo')
connection2.groups.add('foo')
server.broadcast.bar(42) # This is sent to all clients.
server.broadcast['foo'].bar(42) # This is only sent to clients in group 'foo'.

Definition at line 1344 of file websocketd.py.