Questions tagged [empapi]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
128 views

empAPI unsubscribe not working LWC

I am using the empAPI module in LWC and 99% of the code is working. The subscription, receiving of events, etc. all work -- except the unsubscribe method. It is very important for me to unsubscribe ...
Rory's user avatar
  • 389
1 vote
1 answer
240 views

Does a Managed Package LWC that subscribes to platform event need the namespace?

I have a platform event in my managed package. My_Platform_Event__e I have a LWC that subscribes to it. For this LWC to work in subscriber org, does my LWC need to include the namespace? i.e. In my ...
Nick C's user avatar
  • 6,436
1 vote
0 answers
826 views

My LWC (with Emp API implemented) stops receiving Platform Events after some time (6-10 minutes) from the time we opened the page Dev Org

-------------- Info ------------ I have one LWC, where I subscribe to Platform Events using lightning/empApi . Here the JS code from the LWC : import { LightningElement } from 'lwc'; import { ...
Vitalii Dehnerys's user avatar
2 votes
1 answer
4k views

Getting the "empApi setting initialized true for : undefined" log in JS console?

I have one LWC, where I subscribe to Platform Events using lightning/empApi . Here the JS code from the LWC : import { LightningElement } from 'lwc'; import { subscribe, onError} from '...
Vitalii Dehnerys's user avatar
1 vote
0 answers
80 views

CometD in Salesforce Mobile?

I have an app using empApi for desktop subscription to a Platform Event, and the version for Communities replaces empApi with cometD. I'm struggling to find an option for Salesforce Mobile. empApi ...
PatMcClellan__c's user avatar
0 votes
2 answers
646 views

LWC - Cannot Invoke Apex wire service after receiving response from Platform Event using empApi

I am using LWC component in Case Record Page to show Warning Messages. There is no user interaction in this component. Case_Team__c is a Child Object to Case and when data is inserted/deleted/updated ...
Venkat K's user avatar
1 vote
0 answers
59 views

Update LWC field from future/queuable Apex [duplicate]

I have something here which I thought would be simple but is turning out to be a nightmare. I've created an LWC Setup page where a user can create an Account (it's nothing more than an input field and ...
bcarroll2k3's user avatar
1 vote
1 answer
607 views

CDC subscription not working in Lightning Web Component

I have enabled the Change Data Capture for my Custom_Object__c and I am trying to subscribe to these events from a Lightning web component using EmpApi of the LWC framework. Here is my code. // ...
Rahul Gawale's user avatar
  • 11.9k
0 votes
1 answer
597 views

How to retrieve platform event received in last 5 min or based on custom field catchKey__c? [closed]

We are going to use platform event for our API response which will be directly consumed using empAPI, Just have few question can we retrieve specific event other than replayId field ? Can we retrieve ...
Ragul's user avatar
  • 1
1 vote
0 answers
318 views

lightning/empApi: clarification on replayId param in subscribe method

The LWC Docs describe the replayId parameter in the lightning\empApi subscribe method as follows (emphasis is mine): Indicates what point in the stream to replay events from. Specify -1 to get new ...
Matthew Souther's user avatar
1 vote
1 answer
272 views

How to update global variable in emp-api

I need to update a global variable when a push topic is created. import { LightningElement, track,api } from 'lwc'; import { subscribe, unsubscribe, onError, setDebugFlag, isEmpEnabled } from '...
Manoj's user avatar
  • 444
3 votes
1 answer
837 views

LWC + Apex from EMP Api callback : Firing dispatch event or an apex call from Streaming api callback fails in LWC, any workaround?

When a dispatch event or an imperative apex call is made from a streaming api callback, then it throws this error in browser console window and reloads the page . {"event":{"descriptor&...
Nagendra Singh's user avatar
0 votes
0 answers
212 views

How to keep the session alive while subscribing push topic using lightning empApi?

I have a requirement to subscribe to push topic for which i have implemented using lightning empApi and have open the browser in a VM for continuous reading of events and do some actions. The issue is ...
Vivek's user avatar
  • 59
4 votes
1 answer
703 views

How to use LMS & EMP-API in the same LWC component

As both empApi and LMS require the import of the subscribe and unsubscribe methods. How can you use both within the same component? import { subscribe, unsubscribe} from 'lightning/empApi'; import { ...
J Dubbs's user avatar
  • 382
0 votes
1 answer
912 views

showToast from messageCallback function of empApi

I have an empApi subscription to a Platform Event. When that event fires, I want to pull data from its fields and showToast. I'm copying the code straight from the docs, and I can get the platform ...
PatMcClellan__c's user avatar
3 votes
1 answer
900 views

Test lightning-emp-api

Can we simulate an event subscription in LWC unit test? I have a lightning web component using lighting/empApi like, export default class ExampleComponent extends LightningElement { ...
shunkosa's user avatar
1 vote
1 answer
215 views

Empapi lightning web component callback which type

I am developing a simple component to call external service in AWS Which will create PDF file in the s3. When the PDF is created the service will change the object status. Is it possible to use empapi ...
Shinya Koizumi's user avatar
3 votes
1 answer
6k views

LWC - empApi for publishing and subscribing platform event from Lightning web component

I am new to LWC and trying to implement empApi for publishing and subscribing platform event from LWC. Salesforce provided an example on: https://developer.salesforce.com/docs/component-library/...
Prabhjot Singh's user avatar
1 vote
1 answer
1k views

LWC emp API track field is not rendering

I am trying with small example of emp API, everything works fine I am able to subscribe and unsubscribe, however, the response of CDC not printing in the UI for some reason. May I am missing a small ...
Ajay 's user avatar
  • 1,529