I started something similar to what you ask, I do. In my case, I use ConnectionInfo.Path to distinguish between what my sockets do.
You can get a lot of information already from ConnectionInfo
socket.ConnectionInfo.{Host|Path|Origin|SubProtocol|ClientIPAddress|Cookies}
So, to answer your question, to pass it on to everyone except the sender, you can distinguish each socket based on ConnectionInfo (if applicable, you can also create a UID from this information)
As a very simple example:
If you know that each Client will have a different IP address, something like the following:
socket.OnMessage = message => { foreach (IWebSocketConnection socketConnection in allSockets.Where(socketConnection => socket.ConnectionInfo.ClientIpAddress != socketConnection.ConnectionInfo.ClientIpAddress)) { socketConnection.Send("Echo: " + message); } };
source share