Process a continuous stream of JSON

Viewed 66416

The (now defunct) page http://stream.twitter.com/1/statuses/sample.json used to return a continuous and endless stream of JSON data.

I'd like to process it using jQuery (or JavaScript, but preferably jQuery) inside my own web page to be able to display visual effects based on the live feed of tweets.

Since as far as I know the jQuery parseJSON function will only execute the callback function after all the data has been sent by the server, but this is actually a continuous stream of data. How can I process the data "as it happens" but still keep the connection running?

4 Answers

I've got an open source project which allows this on modern browsers (and falls back to a jQuery-style on older ones). The call syntax is similar to jQuery.ajax:

http://oboejs.com

Related