3

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)

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

3 Comments

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.
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.
I would think WebSockets would always be more efficient. If it's more efficient to pre-compute and retrieve periodically in AJAX, WebSockets should be even better because they connection is already established. The data sent is the same either way.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.