I would like to know what is the Streaming API? How can the Streaming API be used in Salesforce applications?


2 Answers 2


The Streaming API is useful in two general scenarios (Source - Introducing Streaming API):

  1. Applications the poll frequently

    Applications that have constant polling action against the Salesforce infrastructure, consuming unnecessary API calls and processing time, would benefit from Streaming API which reduces the number of requests that return no data.

  2. General notification

    Use Streaming API for applications that require general notification of data changes in an organization. This enables you to reduce the number of API calls and improve performance.

In other words, you want to know when something has changed in Salesforce immediately after it happens but you don't want to constantly poll the APIs to see if it has occured.

The Streaming API uses the Bayeux Protocol and CometD to perform long polling of Salesforce. I haven't gone into it in great detail, but I think the client requests data and then just sort of sits there with an extremely long timeout waiting for a response.

In general usage you create a PushTopic to define a channel for what you want to know about. Then in your client application you subscribe to that PushTopic. Whenever the PushTopic criteria are meet in Salesforce your client application will be notified.

I current use the Streaming API in development tools to monitor the creation of ApexLogs and the progress of asynchronous test cases. This saves me a lot of additional API calls to see when the records are created.

See also:


Streaming API are used to provide relevant data to the customer in real time and here the user need not to refresh the screen. They can save the unnecessary consumed time in sending and receiving the data or information and can reduce the number of API calls. Especially for the cases like where polling is required the streaming APIs work better. There are plenty of resources available on the internet through which you can check the detailed description of these APIs.

As far as working of these streaming APIs are concerned, then here server responds to the client as soon as any event is occurred. Until that particular event is occurred the server keeps on waiting and as soon as the event is fired it sends the response to the client. You can take the help of any private Salesforce API integration service provider as well, in order to implement the APIs directly and find the real example as well on the site given by Devendra.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .