4
\$\begingroup\$

I am looking for a lightweight javascript library that allows the server to push update information to the client reliably and regularly. We use a fixed turn time of 300ms and often there are only about 20 bytes of changes. So doing polling using XMLHttpRequest would imply a huge overhead (3-way tcp handshake, http request headers, http response header).

There area number of alternatives, but they have limited browser support:

  • streaming <script>-tags in another frame (does this work on IE?)
  • MIME multipart/x-mixed-replace responses (Firefox, Safari, Opera only?)
  • WebSockets (removed from recent beta version of Firefox and announced to be removed from Opera 11 because of security issues)
  • Server-sent events (only Opera?)
  • Java / Flash relays (requires the users to have those plugins installed)
  • Polling using XMLHttpRequest (huge overhead)

Is there a website which has recent information on which technology works in which browser? Are there javascript libraries which provide a common cross browser interface that hides the messy details? (Yes, i know that it still requires me to write multiple server sides, but that is rather easy. And more important it is easy to write automatic tests for the server sides).

\$\endgroup\$

1 Answer 1

7
\$\begingroup\$

You should look at socket.io

http://socket.io/

It combines almost all the technologies you describe in a consistent API

\$\endgroup\$
1
  • \$\begingroup\$ socket.io uses websockets or httprequest polling internally (depending on what's available) \$\endgroup\$
    – oberhamsi
    Jul 7, 2011 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .