views:

443

answers:

1

I am about to use Ajax for a web dashboard w. real-time updates, planning on using Ajax but i hear websocket might be a good way to go.

Websocket or Ajax?

(cometd & jetty is also an option)

+2  A: 

I recommend using AJAX since it will be compatible with the widest range of browsers.

Web sockets sound promising but are currently only supported in Chrome and Firefox 3.7+ according to Wikipedia.

Justin Ethier
Lets say i can live with just chrome (it's an in-house app) performance wise, do you think websocket will outperform ajax.I'm expecting large volume, large frequency updates.
LoudNPossiblyRight
It depends. On the one hand with web sockets you can immediately know if you have an update, so you will avoid polling overhead. On the other hand if you send every little update down over web sockets the client may end up being too busy processing requests. Depending on the number of updates it might end up being more efficient to pre-compute a dataset and just retrieve it periodically via AJAX. So, consider the requirements of your app and maybe even create a couple prototypes as proof-of-concepts to compare both approaches.
Justin Ethier