+ Start a Discussion
Jitendra RawatJitendra Rawat 

LWC lightning/empApi not working in lightning customer community

I want to show a popup alert on my customer community when an platform event published. But the sample code which I tried as per the lwc component library it's working internally but it's not working on community.
Best Answer chosen by Jitendra Rawat
dandamudidandamudi
lightning:empApi doesn't support  in Communities. but you can build your own using CommetD JS librarary ,it's hardwork
User-added image

All Answers

SwethaSwetha (Salesforce Developers) 
HI Jitendra,
Are you seeing any error message?

Have you set isExposed to true in your <component>.js-meta.xml file ?

Related: https://developer.salesforce.com/blogs/2019/04/lightning-web-components-in-lightning-communities.html

Thanks
Jitendra RawatJitendra Rawat
Yes isExposed there 
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>48.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Alert</masterLabel>
<targets>
<target>lightningCommunity__Page</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
Issue is that same thing component is able to subscribe the platform event if run internally like added on home page but issue with lightning customer community, the community user is "Customer Community Plus" licesnce.
 
dandamudidandamudi
lightning:empApi doesn't support  in Communities. but you can build your own using CommetD JS librarary ,it's hardwork
User-added image
This was selected as the best answer