miguelgrinberg / flask-sock

Modern WebSocket support for Flask.
MIT License
272 stars 24 forks source link

服务端如何同时向多个客户端发送消息? #59

Closed luqijun closed 1 year ago

miguelgrinberg commented 1 year ago

I'm going to do my best to answer best on automted translation of your question.

Each client has its own ws object. To send to multiple clients, you have to send on each of these clients ws instances. If you store your ws objects in a list, you can then use a loop to send something to all the users.

luqijun commented 1 year ago

@miguelgrinberg Thanks.