Clients and Cookies for Streaming API

The client you create to work with the Streaming API must obey the standard cookie protocol with the server. The client must accept and send the appropriate cookies for the domain and URI path, for example https://MyDomainName.my.salesforce.com/cometd.

To ensure continuity during instance refreshes and org migrations, we recommend using your My Domain login URL with Streaming API.

Note

Streaming API requirements on clients:

  • If the content of the post is JSON, the "Content-Type: application/json" header is required on all calls to the cometd servlet.
  • A header containing the Salesforce session ID or OAuth token is required. For example, Authorization: Bearer sessionId.
  • The client must accept and send back all appropriate cookies for the domain and URI path. Clients must obey the standard cookie protocol with the server.
  • The subscribe response and other responses can contain the following fields. These fields aren't contained in the CometD specification.
    • EventType contains either created or updated.
    • CreatedDate contains the event's creation date.