1

this is a follow up question to Platform Event - lightning:empApi. however in my case the component is not working in a standalone Lightning App, but it is working when implementing it on the Lightning Home Page for example. That is the difference to the question above in which Anshul Agrawal mentioned that this empApi is working in a standalone app.

Does anybody has an idea why that might be the case? Based on the empApi specification i expect it to be possible to embed a Lightning Component using the empApi component whithin a standard Lightning App - what is it i am missing?

Background: Based on the explanation provided in https://trailhead.salesforce.com/en/content/learn/projects/workshop-platform-events i built a custom component to subscribe to a Platform Event Channel and print the Result to the Console (for now). I embedded this Component in a Custom Lightning Application, as the use case will require the users to navigate to this standalone lightning application (we don´t want this component to be viewed on a record detail or home page....).

I basically followed along the trailhead explanation, however when opening my Custom Application it seems that the subscribe method of this embedded component is not executed at all - however on the Home Page it is working.

Thanks a lot,

Best, Clemens

5
  • By lightning app what do you mean? made via app builder of .app made in Dev COnsole? Apr 8 '19 at 8:03
  • Hi, i am speaking of .app created via Dev Console.
    – Clemens
    Apr 8 '19 at 8:14
  • so the cometD library used is only present in one.app/lightning experience, hence if not using this you won't be able to subscribe. Apr 8 '19 at 8:16
  • @ClemensMittl The component does not work in Lightning Standalone apps(.app that you created from dev console). If you refer to the documentation, it mentions Lightning Experience -- which will constitute of apps viz., sales cloud, custom apps, service console apps, etc. (any regular apps that we create within Salesforce) OR Salesforce Mobile App. As far as what the OP in the question that you have linked, was referring to, could be one of such apps.
    – Jayant Das
    Apr 8 '19 at 13:14
  • Thanks a lot, Pranay and Jayant provided the insiights required: There is an important differentation between Lightning Apps created via App Builder or via Dev Console - i was unaware of this. My solution will be to add this component via a Lightning Component Tab within an existing App created in the Lightning App Builder. Best, Clemens
    – Clemens
    Apr 8 '19 at 15:57
0

Per https://developer.salesforce.com/docs/component-library/bundle/lightning:empApi/documentation, lightning:empApi is supported only in Lightning Experience and Salesforce Mobile App.

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.