Search code examples
apiresttwitterxmlhttprequestreal-time

REST API - Best practice for 'real time' data


I am developing a dashboard where all (direct) messages, tweets, etc directed at the user will be displayed in one dashboard. All the social media vendors have (OAuth) Rest APIs.

When developing a 3rd party program for an service like Twitter. Is it good practice to request data from the service's API every X milliseconds/seconds, or is there a better way?


Solution

  • It depends on which Twitter API you are interested in. Most of the REST API endpoints have published rate limits found here. If any of these suit your needs, then you would calculate the appropriate frequency of requests that would keep your from exceeding the rate limit.

    Alternatively, if you are accessing Twitter's Streaming API, you would never close the connection.