Question

javascript/jquery question:

I want the browser to read a stream of numeric data (comma-separated integers) from a http-url on the server.

The stream is finite, but can be quite long, and I would like to start processing the data in javascript (draw a html5/canvas/2d graph) incrementally as the data is received, without waiting for end-of-stream before start drawing.

But how do I read the http-stream incrementally? I figured this would be a quite common use-case, but still cannot easily google up a good example...

Can I do this with $.ajax() function?

If so, what event should I respond to, and how do I read data from the partial, incomplete stream that has arrived so far?

Was it helpful?

Solution

For the records... I got answers on the jQuery Forum:

http://forum.jquery.com/topic/process-http-data-stream-incrementally-from-browser

In short:

  • No efficient javascript solution for http stream.

  • Instead, use webSockets, or split the data-stream into multiple shorter chunks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top