I'm working on a WebSockets server that manages connections but I can not solve this small impasse, not for lack of understanding of the code but for not knowing how to do it.
Look,
The user connects to the server
When another user connects to the server (or at least two are connected) they will connect by exchanging information through the server.
When the third connect the same process has to be done, but the first two do not need to reconnect with each other again, they just need to connect with 3 and vice versa .. for all to be connected ..
and so on .. up to a maximum of 20 connections.
In my current server it only receives the message and passes it to all connected less to the one that is sending the message, and this causes the third one to connect with the first one but not with the second one becomes a mess ...
It's worth noting that the server only passes the messages, who actually treats them and makes the connection is the user in the Browser .. The server is only the signal tower
How to do this administration in PHP or at least the logic for me to try to do it alone ..