In XSockets 3.* the framework support pub/sub which means that client subscribe to topics and then get messages when there is a publication on the topic.
So your assumption about all messages being sent to all clients is wrong. It would be a very bad solution to send all messages to all clients and let the client API filter away messages not wanted. So the server actually keeps track of the clients subscribing.
Ofcourse there is much more to it than that in XSockets since you also can choose to only send to a subset of the subscribers by saying for example
this.SendTo(p => p.Age > 18 && p.Age < 25 && p.Location == "UK", "Hello young people in UK", "topicOfChoice");
If you want to build you own client the XSockets team will surely help you out.
You actually only need the get the information about what to send to "subscribe", "unsubscribe" etc. All messages follow a protocol that XSockets uses to know where to dispatch them and what to do.
I would strongly recomend to write the client for 4.0 since there are very big changes in 4.0 vs 3.*
In 4.0 a message can look like this
{"D":"{\"text\":\"Hello World\"}","C":"Chat","T":"chatmessage"}
That message basically means:
DATA
"D":"{\"text\":\"Hello World\"}"
CONTROLLER
"C":"Chat"
METHOD/TOPIC
"T":"chatmessage"
So the messages really say, send {text:'Hello World'} to the controller Chat and the method ChatMessage (could be some misstakes, writing from my head)
The controller Chat could look something like this
public class Chat : XSocketController
{
public void ChatMessage(string text)
{
this.InvokeToAll(text,"chatmessage");
}
}
The sample above uses RPC which means that all clients connected to this controller would get the message. If you need publish/subscribe you just replace
this.PublishToAll(text,"chatmessage");
Now only the clients with a subscription for the topic "chatmessage" will get the data
Then you can ofcourse do better pub/sub or rpc with the
PublishTo<T>(Func<T,bool> exp, object o, string topic)
or the
InvokeTo<T>(Func<T,bool> exp, object o, string topic)
Soo... if you want to write a client I suggest you contact XSockets to get all the information about what to send to do a publish/subscribe etc...