Will websockets in HTML 5 replace ajax for partial page refresh?

I just stumbled upon the websockets feature included in HTML 5 here . At first glance, it seems that after Firefox and IE board the specification, ajax may be redundant. My question is: in your opinion, will ajax (using jquery $ .ajax () or even with direct XMLHttpRequest / another) replace this new ws: // protocol?

If so, when should we begin to change our development methodologies?

+5
source share
3 answers

Websockets address a different need than XMLHTTPRequests. The latter means that his name says: query: you know that you need something (that is, because the user clicked a link, scroll, or something else), and you get it - and XHR does an excellent job of this.

The malfunction begins when certain events can be triggered on the server server, which should be sent to the client in real time. The only thing you can do right now is to regularly test the server - this is a hack that contains many problems. And this is exactly the problem with which websites are created: Provide a browser for viewing in real time for real-time notifications.

I think Ajax XOR Websockets is a kind of false dichotomy. They affect different needs and can coexist peacefully.

+5

-.

0

I'm a little skeptical. All major browsers started supporting ajax in 1999, and it gained popularity around 2005, after launching gmail. And we have not reached this point when the main browsers support websockets (add a couple more years).

There is a simple reason for the delay in adopting ajax: the need for websites to support older versions of the browser. (Remember how many people still use IE 6 & 7?)

0
source

All Articles