0

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 ?

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the links linus, i ll invetigate these options and see what ends up fitting best.
1

Yes, this is doable. This is how comet streaming servers work.

See http://faye.jcoglan.com/ for an example for Node.js.

2 Comments

Thanks this looks a lot like what i would need, are you by anychance aware of a PHP equivalent ?
Not specifically. Googling "php comet server" has a few results, and also turns up this related question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.