Friday, June 1, 2012

Twitter Stream APIs Comparison

Twitter REST API is polling-based.  On contrast, Twitter Stream API pushes the tweet data to client as they become available thereby eliminating the polling overhead and reducing the latency.

There're three types of Stream APIs: public streams, User streams and Site streams.  Our company has been using public stream for the past year or so and now are moving to UserStreams/SiteStreams. Following is a side-by-side comparison of these three APIs.

Streaming Endpoint
Use case
Public streams

Streams of the public data flowing through Twitter.
One user app for data analysis.
.         Each Twitter account may create only one standing connection.
         No support for Direct Message.

User streams
Single-user streams, containing roughly all of the data corresponding with a single user's view of Twitter.
Single-user, client-side desktop app/mobile app that provides equivalent view of their home timeline.
         Each Twitter account is limited to only a few simultaneous connections per OAuth application, regardless of IP.
.       The number of simultaneous connections per IP address is still limited, regardless of application.  
Direct message is supported in the context of the authenticated user under which the connection is established.
Site streams

Multi-user version of user streams.
Multi-tenant websites or mobile push services that provide home timeline on behalf of many users at a time.
          Max 100 users per stream while connecting; can add up to 1,000 users per connection through API.
         Max 25 new connections per second.
Deliver both public and private data in a single stream.  Must be very meticulous about what data they display to whom.

No comments:

Post a Comment