remudada
remudada

Reputation: 3791

python uwsgi 2.0 websocket implementation

I am working on a websocket implementation based on uwsgi 2.0 in python. I am a little confused about how messages are sent from the websocket server to the client. Would appreciate if someone would clarify the following for me.

  1. When uwsgi.websocket_send(msg) is used, is the message sent to all connected clients or the one for which the handshake is established?
  2. Is it possible to use websocket to send messages to a group of clients (channels) if yes, are there any examples out there for this?

Upvotes: 1

Views: 1542

Answers (1)

roberto
roberto

Reputation: 12953

the whole api is peer 2 peer, uwsgi.websocket_send send to the currently connected peer. You need an additional layer (generally redis) to have room/channels support.

This is an example (gevent + redis) https://github.com/unbit/uwsgi/blob/master/tests/websockets_chat.py

Upvotes: 3

Related Questions