views:

44

answers:

1

Hello everyone. I am building a complex HTML 5 application that takes advantage of Websockets. I am getting to the point where I have a lot of different types of data that gets updated in real time on the screen.

I want to know if it is going to be better for me to have fewer Websockets that are more complex, or a lot of simple Websockets open per page.

I added http://github.com/TooTallNate/Java-WebSocket web socket server to my Grails Application.

Right now I am going down the path of using a lot of simple web sockets for each task. I know using more sockets will use more memory on the server side but also more sockets means more concurrent processing.

Does anyone have any advice on how I can balance this.

Thanks for any tips in advance. Keith Blanchard

A: 

I think it is hard to make any reasonable statements about websockets without measuring the actual performance in specific browsers.

My inclination would be to have a single websocket per client. There are some pretty hard limits on capacity server-side when doing IO ... relatively easily to saturate the channel when you have many connections (something that can bite heavily ajaxified systems as well).

Again, need to really measure to make intelligent statements about this.

Websocket-per-client would also make the application much more manageable ... depends on your actual use-case, but "more concurrency" is not necessarily better and can make managing state incredibly complex.

Toby Hede