I just updated Tornado's httpclient to include a streaming_callback parameter which allows you to process data as it arrives (the param was somehow lost when httpclient was extracted from the FriendFeed code).
To use it, just do something like:
http_client.fetch("http://stream.twitter.com/1/statuses/filter.json?follow=IDS...,
cb, streaming_callback=self._handle_data, auth_username=...)
def _handle_data(self, data):
lines = (self.prev_linepart + data).split("\n")
self.prev_linepart = lines[-1]
lines = lines[:-1]
if not lines:
return
for t in lines:
try:
tweet = tornado.escape.json_decode(t)
This is great! For me, the best thing about it is that it actually allows me to tweet, a feature that has not worked for me on the Twitter website for several weeks. It is nice to be able to tweet from a browser again.
Twitter seems to be pretty dodgy at the moment with the increased # of requests going to it. Its giving 503's. Refreshing a few times (brute force!) eventually gets you through.
I'd love to see this built own. A live-updating, clean, and light weight web based twitter client doesn't exist. I'd subscribe for a few bucks a month to use it.
Agreed, though that's only for certain browsers. Hopefully either those browsers fix it or some hack around it is established. What browser are you using?
Until getting any push/real-time features is going to come with that.
Many hacks around it are established. Take a look at the Orbited project, http://orbited.org/, or come talk to us in IRC (in #orbited on freenode) if you want help figuring out how to avoid the UI side-effects.
http://github.com/godavemon/TwitTornado
A bit more about TwitTornado
http://twittornado.com/about
It was a fun and short project. I highly recommend Tornado to anyone needing a push framework.