开发者

Which is faster - WebSockets or Ajax?

I bet WebSockets are much faster. So if I want to use lots开发者_如何学C of ajax continuously, WebSockets are recommended as an alternative?


It's two different technology things. With AJAX client just send request to server and wait to response. Websocket is HTML5 implementation for Comet technology, the idea is push information from server to client.


Ajax is slower because the overhead. But Ajax is more compatible, Websocket is currently a bit experimental and it is not widely supported by most browser.


I think is not a issue of speed, is a issue of comunication and real time process


If you're in regular need of asynchronous data transmission I'd say you should try out websockets, it's really easy to use. One problem is - because of the early stage - the websocket interface might change (which has happended already) and render your web application unusable until you update your code.


Definitely WebSockets!. During my last internship, we used WebSockets together with Erlang to build a chat app for feature phones. Not only was it resource-efficient, it was also faster, and really realtime - connections are always open, until either end closes.

And oh, they are experimental but works well on Chrome, Firefox, Android and iOS. The only problem was with parsing data with BB which was because of the library we were using, so we rewrote the library's data parsing algorithm and it worked. We tested on only these platforms.

You can checkout Socket.IO which improves upon the raw implementation of WebSockets. Visit this link for some quick demos: http://socket.io/#how-to-use

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜