As we are using Cometd and platform Events to get the communication happen between Asynchronous Apex and Lightning Component(Lightning Out) it's working fine for some times, and getting the following exception some other times

20:12:12.801 Exception during handling of messages Unrecognized advice action handshake

i have gone through so many questions and realized it is a known issue, it will be solved if we use empAPI . But the problem here is empAPI don't support in lightningout. So how can i resolve this?

VF Page

<apex:page title="MAL and NAL update" >
<apex:includeLightning />
<div style="padding-bottom:3px;" id="MalandNal" />
    $Lightning.use("c:MALandNALBulkUpdateApp", function() {
      { },
      function(cmp) {
        // do some stuff

Component which subscribes the event

<aura:component Controller="MALandNALBulkUpdateController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,forceCommunity:availableForAllPageTypes" access="global">

<aura:attribute access="public" name="successMessageList" type="String"/>
<aura:attribute access="public" name="errorMessageList" type="String"/>
<aura:attribute access="public" name="messageList" type="List"/>
<aura:attribute access="public" name="filteredList" type="List"/>
<aura:attribute access="public" name="fileName" type="String" default="No File Selected.." />
<aura:attribute access="public" name="user" type="user"/>

<aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
<aura:handler event="aura:doneWaiting" action="{!c.hideSpinner}"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<!--create a component attributs -->
<aura:attribute name="Spinner" type="boolean" default="false"/>
<aura:handler event="aura:doneRendering" action="{!c.done}" />

<!--Include StreamingApiHandler child component and pass channel name to subscribe
 once the event is fired, it will handled in handleMessage controller method -->

<c:StreamingApiHandler channelName="/event/Notification__e" onStreamEvent="{!c.handleMessage}" />

handleMessage on JAVASCript controller

handleMessage : function(component, event, helper) {
    const param = event.getParam('message');
    var messageList=component.get("v.messageList");
    //console.log(`Account "${param.sobject.Name}" with Id ${param.sobject.Id} is ${param.event.type}!!`);

Batch Class which publishesh the events

global class MALNALBatchClass implements database.Batchable<String> {
public list<String> fileRows;
public String organization;
global MALNALBatchClass(List<String> fileRows,String organization){

global Iterable<String> start(Database.BatchableContext bc){
    return fileRows;
global void execute(Database.BatchableContext bC, List<String> fileRows){
    MALandNALBulkUpdateController malAndNAL=new MALandNALBulkUpdateController();
    //publish event 
    Notification__e notify = new Notification__e(Id__c=malAndNAL.messageList[0].id,is_Success__c=malAndNAL.messageList[0].isSuccess,
    Database.SaveResult result = EventBus.publish(notify);
global void finish(Database.BatchableContext info){


closed as off-topic by Sebastian Kessel, Pranay Jaiswal, Vijay Ganji, Raul, glls Jun 24 at 15:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Sebastian Kessel, Pranay Jaiswal, Vijay Ganji, Raul, glls
If this question can be reworded to fit the rules in the help center, please edit the question.