Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Very cool, but there's one thing I don't understand.

Do you need to stream JSON objects from a server to make this work? You have to get a response from the server in some kind of streaming protocol right?

Or...

Is this just reading the part of the JSON string that it currently has?

I'm inexperienced with streaming, so this might be obvious to some.

EDIT:

Ah, I get it. I was wrong to say it was "streaming". Looks like my second suggestion was the correct one.



If you've spent too much time in jQuery you might not realize that streaming is supported by the underlying XMLHttpRequest object. The readyState property can be set to LOADING or DONE. Most applications will wait for DONE so they have a complete document to work with. A "normal" payload will be small enough that the lag between LOADING and DONE is tiny, but a big download can definitely be parsed as it loads. Imagine an HTML doc with inline JavaScript. That JavsScript is evaluated as soon as it's encountered and doesn't wait for a page load that may never happen.


It will work with any JSON but It'll work faster if you write the JSON out a bit at a time.

Consider if you are writing data from a db: you can either collect all the rows together then write them out, or you can write them out one at a time as you get them. If you write one at a time you are in a sense streaming even if you're not using a streaming protocol.

On a slow network reading any http is like a stream because you can use the first bit to arrive without waiting for the rest. The faster the network the less the benefit but it shouldn't end up worse.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: