Use Streaming API to receive notifications for changes to Salesforce data
that match a SOQL query you define, in a secure and scalable way.
These events can be received by:
- Pages in the Salesforce application.
- Application servers outside of Salesforce.
- Clients outside the Salesforce application.
The sequence of events when using Streaming API is as follows:
- Create a PushTopic based on a SOQL query. This defines the channel.
- Clients subscribe to the channel.
- A record is created, updated, deleted, or undeleted (an event
occurs). The changes to that record are evaluated.
- If the record changes match the criteria of the PushTopic query,
a notification is generated by the server and received by the subscribed
Streaming API is useful when you want notifications to be pushed from the
server to the client based on criteria that you define. Consider the
following applications for Streaming API:
- Applications that 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.
- 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.