My Requirement:- we want to display the notifications without reloading the page and without any streaming API. if any change happens on the record from a custom lightning page.

I have done some R&D. then I found something like PlatformEvents and empApi Components. I tried two scenario's Created One platform Event Object.

1) Publishing the notification from Process Builder and able to get notifications in Bell Icon.

2) Publishing the Notification from process builder. For Subscribing the event, created lightning component with help "empAPI component" and added my component to a lightning page, then I can able to see the notification in console. But if add the same component into Lightning Application, not able to see the notifications.

I guess event not subscribing, little confusing. Below is the code snippet.


<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    <aura:attribute name="sub" type="map" />
    <lightning:empApi aura:id="empApi" />   
    <lightning:notificationsLibrary aura:id="notifLib"/>


    init : function(component, event, helper) {
        alert('init() calling');        
        var empApi = component.find("empApi");
        var errorHandler = function (message) {
            console.log("Received error ", message);
        var channel='/event/Custom_Notification__e';
        var sub;
        var replayId=-1;        
        var callback = function (message) {
                "title": "Message Received!",
                "message": message.data.payload.Notification_Title__c
                console.log("Notification Title>>>>>>" + message.data.payload.Notification_Title__c);
        empApi.subscribe(channel, replayId, callback).then(function(value) {
            console.log("Subscribed to channel " + channel);
            sub = value;
            component.set("v.sub", sub);

Lightning App:-

<aura:application extends="force:slds">
     <aura:dependency resource="markup://force:*" type="EVENT"/>    

Could you please help any one.



1 Answer 1


From the documenation of empApi , its only available in Lightning Experience. enter image description here

Your component needs to be inside Lightning experience.. not a standalone app, as the standalone app does not have enough libraries to support commetD.

  • Hi Pranay, Thanks for the reply
    – Ragavendra
    Commented Oct 22, 2019 at 12:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .