Filter connections to send data

Nov 8, 2010 at 9:08 PM

Is there an easy way to filter the clients to which you want to send data.

I highlighted some important text below.

The WebSocketServer class has the private 'Connections'.

My serverdefinition looks like this:

wss = new WebSocketServer(8081, "http://local-ics", "ws://local-ics:8081");
            // register the ConsoleAppSocket class to handle connection comming to /consoleappsample
            // start the server

the server has a method:

protected void SendMessage(string message)

This is all ok, but what I need is this

protected void SendMessage(Guid userId, string message)
   // a way to filter the connections from the websocketserver (wss) based on the UserId property in MyWebSocket.

Nov 9, 2010 at 6:30 AM

yeah, thats one of the things I'd like to make easier, but i haven't figured out a good solution yet, i guess you could just make the list public, or maybe add the a guid to the webSocketConnection class, and add the method you lack to the WebSocketServer class. Either way, i think you need to alter the source, or you could maybe do something like this:

Nov 9, 2010 at 9:40 AM

I'll definitely dig deeper into the architecture. There is indeed some room for improvement. Especially on the connection-filtering to send messages.

If I come up with a solution, I'll let you know.