2

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?

2
  • Maybe duplicate of stackoverflow.com/questions/7740646/… Commented Apr 14, 2014 at 23:09
  • @tampis I've seen that question, but where exactly is the working answer? It's a link to the "Ajax Patterns" site with snippets of php-code (server-side). What's that got to do with javascript (client-side)? I dont get it... Commented Apr 15, 2014 at 4:22

1 Answer 1

2

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.

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

Comments

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.