walkor / workerman

An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols.
http://www.workerman.net
MIT License
11.16k stars 2.26k forks source link

Multiple connection to one user? #1044

Open mumus opened 3 months ago

mumus commented 3 months ago

Hello. Please tell me, I use Workerman in my web application to send server notifications to clients. I don't understand how to solve this problem: The user came from a PC, logged in to the site and connected to the web socket via a link like this: wss://mysite.com:1234?Username=User. Then he logged in to the site via phone, and I allow the previous session on the computer not to end. Therefore, he has the same link where Username=User. But notifications are sent only to the last connected web socket. It is possible to union connections with one Username?

akotulu commented 1 month ago

No, you need to implement a dispatch system which sends messages to connected clients. Eg separate WS connections to dictionary which where connected as you described and send message to those connections only.