Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way for the Google App Engine's urlfetch to open and keep open a Twitter Streaming API connection?

The Twitter streaming api says that we should open a HTTP request and parse updates as they come in. I was under the impression that Google's urlfetch cannot keep the http request open past 10 seconds.

I considered having a cron job that polled my Twitter account every few seconds, but I think Google AppEngine only allows cron jobs once a minute. However, my application needs near-realtime access to my twitter @replies (preferably only a 10 second or less lag).

Are there any method for receiving real-time updates from Twitter?

Thanks!

like image 645
ehfeng Avatar asked Oct 15 '22 15:10

ehfeng


1 Answers

Unfortunately, you can't use the urlfetch API for 'hanging gets'. All the data will be returned when the request terminates, so even if you could hold it open arbitrarily long, it wouldn't do you much good.

Have you considered using Gnip? They provide a push-based 'web hooks' notification system for many public feeds, including Twitter's public timeline.

like image 102
Nick Johnson Avatar answered Oct 18 '22 11:10

Nick Johnson