22 votes

What is the difference between the Streaming API PushTopic, Generic Streaming and Platform Events

Very generally, the Streaming API was created primarily to update UI components(Source) where as Platform Events are for integrations via a Message Bus. With a PushTopic from the Streaming API you are ...
Daniel Ballinger's user avatar
17 votes
Accepted

The better way to import cometD library into LWC

You do not need EMP-Connector if you are using lwc. Salesforce has a lightning-emp-api base component for it (https://developer.salesforce.com/docs/component-library/bundle/lightning:empApi). The ...
Mohith Shrivastava's user avatar
15 votes

What is the difference between the Streaming API PushTopic, Generic Streaming and Platform Events

Another significant differences - In streaming API's we lose the update (event) if the subscriber is offline, however in platform events they will be available in the event bus for a duration of 24 ...
Salesforcesmarty's user avatar
12 votes

empApi with Lightning Web Components?

How about option 3: Wait a week. According to the release notes, EmpApi is currently slated to go live in LWC for Summer 19.
pchittum's user avatar
  • 19.7k
11 votes
Accepted

Best API option for returning records with only specific changes?

The best object will be dependent on a number of factors, such as how quickly you want to know about the change, how many records are expected to change over the period of interest, and how many API ...
Daniel Ballinger's user avatar
11 votes
Accepted

Change Data Capture vs Platform Events vs Replication API vs Streaming API vs Batch Data Synchronization

The replication API is designed to have synchronization windows of at least five minutes, so would not be suitable for synchronization of shorter periods. Most ETL tools also don't support windows of ...
sfdcfox's user avatar
  • 491k
11 votes

Change Data Capture

Change Data Capture : Receive near-real-time changes of Salesforce records, and synchronize corresponding records in an external data store. Change Data Capture publishes data change events, which ...
Hemavantha Rajesh Varma Mudunu's user avatar
10 votes
Accepted

Will Change Data Capture eventually replace PushTopics/Streaming API?

There are a lot of considerations behind this and I'm not on the engineering teams that are behind these features so take my answer with a grain of salt. The TL;DR is yes, Change Data Capture (CDC) ...
POZ's user avatar
  • 4,364
9 votes
Accepted

Lightning components, CometD - Refused to connect to ... because it violates the following Content Security Policy directive

The error you are reporting is related to the fact that the Salesforce Platform does not yet provide a WebSocket server for Platform Events. While waiting for this feature, you have to add this line ...
POZ's user avatar
  • 4,364
8 votes
Accepted

Streaming API in Lightning Component API 40

As a data point I would be interested to hear if you get this working for you what the key modification was to do so. Maybe "OAuth" instead of "Bearer", the callback pattern, the versions, etc. So ...
Eric's user avatar
  • 54.2k
8 votes
Accepted

Change Data Capture

CDC and Platform Events are really different use cases. Platform Events are a generalized event-driven, publish/subscribe mechanism. You can publish Platform Events to represent record changes (in ...
David Reed's user avatar
  • 92.8k
8 votes
Accepted

Cannot subscribe to Capture Data Changes (CDC) channel using EMP Connector

CDC events only fire when you enable CDC from Setup. You can enable Change Data Capture from Setup -> Change Data Capture and Select Objects for whom you wanna enable CDC
Pranay Jaiswal's user avatar
7 votes
Accepted

Lightning Data Services vs. Streaming API

A Lightning Data Service record will only update on-screen if the record is edited/updated in another Lightning Data Service context. So, assuming that the database change is not done by the same ...
Guy Clairbois's user avatar
7 votes
Accepted

Streaming Api >= 37.0 sending messages twice

It seems that with the newer streaming api versions, the initial update of a record generates an event, and then when field update actions from the workflow rules fire, another event is generated. So ...
martin's user avatar
  • 12.6k
7 votes

The better way to import cometD library into LWC

Community licenses don't support Streaming API, therefor empApi doesn't work. Streaming API is based on Push Topics and Read of Push Topics are not supported by Community License (so you can create ...
ytiq's user avatar
  • 4,515
6 votes
Accepted

Streaming API in Salesforce

The Streaming API is useful in two general scenarios (Source - Introducing Streaming API): Applications the poll frequently Applications that have constant polling action against the Salesforce ...
Daniel Ballinger's user avatar
6 votes

Find current API version in Apex

There is a tricky way to get it. You can query attachment by following SOQL, "SELECT Id, Body FROM Attachment limit 1" salesforce return attachment body as an url like below, /services/data/v36.0/...
Allen Li's user avatar
  • 860
5 votes
Accepted

Publishing platform event using trigger?

Yes, you can do this in a trigger. It works almost the same as any other type of operation: MyEventName__e[] events = new MyEventName__e[0]; for(...) { ... events.add(new MyEventName__e(...
sfdcfox's user avatar
  • 491k
5 votes
Accepted

empApi with Lightning Web Components?

Summer 19 is 1 week away, but that won't stop you from preparing it beforehand in your Summer 19 Sandbox or Scratch org. lightning:empApi does not show LWC button as enabled as its referring to the ...
Pranay Jaiswal's user avatar
4 votes

Named Credentials in Lightning Component - Streaming API

I have done something similar to make a call to the Salesforce Rest API from lightning (well technically Apex). The session that lightning produces is an isolated session that can't be used anywhere ...
John De Santiago's user avatar
4 votes
Accepted

Streaming logs in API 37 and up

Confirmation from twitter that they are making changes around supporting platform events in the future. Twitter Exchange: Me Why would the #Salesforce Developer Console still be using v36 of cometD ...
Daniel Ballinger's user avatar
4 votes

Find current API version in Apex

I think the reason there is no easy way is that an org actually supports many versions. So we really want the newest. I wrote this code: public class VersionResponse { public String label; ...
Lanny's user avatar
  • 41
4 votes

Minimise delay between Streaming API and Heroku Connect

My application instantly writes to the HC PostgreSQL database, which instantly writes up to Salesforce. This is a common misconception. Heroku Connect is not a real time sync service, but rather an ...
Caleb Hearth's user avatar
4 votes
Accepted

Streaming API in Lightning Component getCallback error

Looks like you have used wrong variable name , happens when you copy paste the code from somewhere else , Here is the line that needs to be checked sessionAction.setCallback(this, function (a) { ...
Mohith Shrivastava's user avatar
4 votes
Accepted

Subscribe to multiple channels using CometD

As @sfdcfox mentioned in the comments, the new lightning:empApi component can be used to achieve multiple streaming connections in a single component or browser window. I got this working with ...
Aislinn Hayes's user avatar
4 votes

Can the cometd library be used in Salesforce to listen to external buses?

I'm assuming you want this to be something running in Apex and not something that relies on Visualforce or Lightning Component. If you want to have Salesforce subscribe to an event, you will need to ...
Daniel Hoechst's user avatar
4 votes

Can the cometd library be used in Salesforce to listen to external buses?

As of now, we do not have a way to subscribe to the external event bus which is always on. You have to use a middleware to subscribe to external event bus and then push same into SF event bus. We use ...
Pranay Jaiswal's user avatar
4 votes
Accepted

Can the cometd library be used in Salesforce to listen to external buses?

If the external bus supports the Bayeux protocol, then you could use the same CometD library and code to subscribe to both the Salesforce bus and the external bus. The solution in this case would be ...
John Brock's user avatar
4 votes
Accepted

Why would I use Streaming API over Outbound Messages?

Outbound messaging is primarily server-driven. If your server went down for some reason, and you bring it back up, it would have to wait for messages to be delivered from Salesforce, which could take ...
sfdcfox's user avatar
  • 491k
4 votes
Accepted

Retrieving old platform events using replayId as -2

You're having network connection problems. Please contact your IT department or Internet Provider. Documentation: 403::Unknown Client: The server deleted the client CometD session due to a timeout,...
sfdcfox's user avatar
  • 491k

Only top scored, non community-wiki answers of a minimum length are eligible