Skip to main content
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,449
7 votes
Accepted

CometD Issues when subscribing to Platform Events

This is a know issue documented in the Platform Event project Build an Instant Notification App: If you notice an "Exception during handling of messages Unrecognized advice action handshake" ...
POZ's user avatar
  • 4,449
6 votes

CometD Issues when subscribing to Platform Events

I'm receiving this message as well. Not in the Trailhead but in my own code both within Visualforce page and withing a lightning component. I don't think you can catch this exception as it's caught by ...
ChiCloud's user avatar
  • 159
5 votes
Accepted

How to publish Platform Event from aiosfstream python library?

I'm the author of aiosfstream. Thanks for notifying me about this question! tl;dr You can use aiosfstream to subscribe and listen for platform events, but you can't use it for publishing. To ...
Róbert Márki's user avatar
5 votes

Cannot subscribe to platform events using cometd

There are some Salesforce Docs on Subscribe to and Replay Events Using a Visualforce Page. They seem like a good place to start. Here I'll replicate that example, except from sfdx. sfdx force:...
Daniel Ballinger's user avatar
5 votes
Accepted

Platform Event stuck in OPERATION_ENQUEUED status?

This isn't a complete answer, because it doesn't solve your issue. But I wanted to explain what you're seeing with that error message. Even though getErrors returns an error, that "error" is ...
Nathanael Schmolze's user avatar
4 votes
Accepted

Consuming platform events on AWS

This use case is addressed in the following Amazon AppFlow Trailhead module Basically you configure AppFlow to subscribe to Salesforce Platform Events and then you can continue your logic in AWS, for ...
jonathanwiesel's user avatar
4 votes

Unable to subscribe to platform event using emp api

If you view the documentation for lightning:empApi, It only works in Lightning experience or Salesforce mobile. I try to view your component as VF page or just the App then it fails to load. then I ...
Pranay Jaiswal'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
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

Unable to call Application Event from VF Page

I found out that ConversationReload Event doesn't have access="global" and VF Page from where I was trying to access event was not part of the package.
Saurabh Mishra's user avatar
4 votes
Accepted

Cometd not working in summer 18

I don't know if this is the right answer but I'm gonna drop the possibility here... Locker Service defines a few trusted origin domains. Take a look at this commit: https://github.com/forcedotcom/...
Charles T's user avatar
  • 11.1k
3 votes

Calling LWC Javascript function from subscribe () method of cometd result in function undefined

As you are using an anonymous function, it will not have access to the this of your component. A this inside that function will refer to the function itself. To overcome this, you have two options. 1 ...
Rahul Gawale's user avatar
  • 12.2k
3 votes

Publishing an event to Salesforce via CometD

You can't push a message to Salesforce event bus through CometD. From the doc: Streaming API supports the following CometD methods: connect The client connects to the server. disconnect The ...
identigral's user avatar
  • 7,747
3 votes

"Cannot add property context, object is not extensible" error during CometD handshake in Lightning Component

As sbordet said in the comment above, there was a solution (or at least workaround) given in the question I linked to, that I somehow missed. Here is the workaround provided by Grekker in that thread: ...
kacrouse's user avatar
3 votes

Does Authorization using a OAuth access token work for CometD?

Forget it the HOST in the URL is wrong https://na73.salesforce.com should be used instead of https://na73.lightning.force.com/
ploc's user avatar
  • 315
3 votes

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

The Lightning Component framework uses Content Security Policy (CSP), which is a W3C standard, to control the source of content that can be loaded on a page. To use third-party APIs that make ...
glls's user avatar
  • 20.3k
2 votes

Initialise streaming client on button click, rather than init

You could just add a bit of code: <aura:attribute name="streamingEnabled" type="Boolean" default="false" /> <aura:attribute name="streamingLoaded" type="Boolean" default="false" /> <...
sfdcfox's user avatar
  • 500k
2 votes

Platform Event for Guest Community User?

If you can spend a full platform license for it, you can. On your community uses Apex callout to log in into SF using Oauth2 flow. Store username-password for callout in Apex/ custom setting. The ...
Pranay Jaiswal's user avatar
2 votes

Publishing an event to Salesforce via CometD

We can publish event to Salesforce EventBus from an external application by making use of API only. You can use any Salesforce API to create platform events, such as SOAP API, REST API, or Bulk API. ...
Jasneet Dua's user avatar
1 vote
Accepted

Streaming API - How do I automatically queue a retry of a failed messages?

Does this help? source https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/using_streaming_api_stateless.htm “In API version 37.0 and later, Streaming API stores events ...
Peter Noges's user avatar
  • 1,140
1 vote

Do I need to re initialize longpolling client with new access token on every connection session timeout?

In the case of server timeouts, the client connects again and starts over. Reference > https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/BayeauxProtocolAndCometD.htm
user11's user avatar
  • 43
1 vote

Getting "has established a session, but no BAYEUX_BROWSER cookie present" When Connecting To Platform Events Channel

I am the CometD Project leader but I don't know the details of the SalesForce integration, so my answer may or may not apply. When a CometD client first connects to a CometD server, it sends a ...
sbordet's user avatar
  • 131
1 vote

Issue with platform event Subscription

Although not a direct solution, I have also had similar issues with the 403::Unknown Client error. What I noticed with the seemingly inconsistent subscriptions was that the error would only occur when ...
Ameer Awad's user avatar
1 vote

How to solve inconsistent 403::Unknown Client error on subscribe when using lightning:empApi

The problem in helper method posted is that it uses the isEmpEnabled function incorrectly. The isEmpEnabled function returns a promise not a boolean. If this is fixed so that isEmpEnabled is called ...
bafuda's user avatar
  • 757
1 vote

How to use latest cometd version in Salesforce StreamingAPI

I assume you were setting up the connection cross domain. It appears the streaming API isn't supported. Since salesforce hasn't setup CORS, the Preflight request will fail and you'll see that cometd ...
NSjonas's user avatar
  • 10.2k
1 vote

Subscribe Salesforce without using EMP Connector

You can't currently1. The Bayeux protocal via CometD is the only push technology currently supported by Salesforce for the Streaming API. From Bayeux Protocol, CometD, and Long Polling: Long ...
Daniel Ballinger's user avatar
1 vote

Need some more information on Salesforce Streaming API

[Disclaimer, I'm the CometD lead, so I can answer about CometD - what SalesForce uses may be slightly different although for this particular question I think the answer below holds for SalesForce too] ...
sbordet's user avatar
  • 131

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