Reputation: 4820
Following up on this question I was wondering is there is a way, without using socket.io, to avoid the buffering of the response that happens on most navigators. So for instance if the node server emit every 5 secondes : 'hello world' i can directly print them on a webpage as soon as the data is available.
Is there a way to do so ?
Upvotes: 0
Views: 178
Reputation: 3605
Yes, this is doable. This is how comet streaming servers work.
See http://faye.jcoglan.com/ for an example for Node.js.
Upvotes: 1
Reputation: 39231
Unfortunately, this is not how web browsers work. If you want this type of functionality without using WebSockets (or a socket.io fallback) you could try with Server-Sent Events. See this gist for an example (in coffeescript). Also, here is a polyfill for older browsers.
Upvotes: 1