Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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).

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

You should look at socket.io

http://socket.io/

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

share|improve this answer
    
socket.io uses websockets or httprequest polling internally (depending on what's available) –  oberhamsi Jul 7 '11 at 14:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.