A quick run down of the session that I (Jonathan Fox) did for Dreamforce 22 on the Developer Theatre stage for the Developer Track, covering the Pub/Sub API
Hi! I'm not sure what situation you mean? - You can subscribe via empAPI as that doesn't differentiate between Streaming/PubSub as you are defining the Data/Event message you are subscribing to. As you're LWC is on platform, as you would with any other record, your LWC would call and Apex class to either 'publish' a platform event or change a record triggering CDC. If this is not the situation you are referencing, are you meaning when using 'Lightning out' otherwise I'm not sure how you're using LWC off platform?
@@JFoxUK hey thanks for Prompt response. I was asking for the scenario when we want to use empApi in Experience cloud. We had a custom LWC based experience cloud site where we wanted to know the CDC event but unfortunately empAPI is not supported in Experience cloud at the moment. Hope you got my situation?
@@akashdeep8229 There are workarounds to that where I have seen people try to make a CometD client in an LWC to subscribe etc, though you may be best just using your LWC to poll a record for the change via Apex.
@@JFoxUKThanks, Yeah, I went through these workarounds. CometD : Enterprise won't approve it for Prod because of 3rd party library. Polling: This will have significant impact on the performance if we poll using setInterval. As Pub/sub api is getting away from cometD I was just guessing if we can use it in LWC like ui/api.
Love from Bangalore ❤️ 🇮🇳
Thanks a lot for sharing this material, it is really easy to follow.
Can we reference this API in LWC components? as existing empAPI don't work outside lightning experience.
Hi!
I'm not sure what situation you mean? - You can subscribe via empAPI as that doesn't differentiate between Streaming/PubSub as you are defining the Data/Event message you are subscribing to. As you're LWC is on platform, as you would with any other record, your LWC would call and Apex class to either 'publish' a platform event or change a record triggering CDC.
If this is not the situation you are referencing, are you meaning when using 'Lightning out' otherwise I'm not sure how you're using LWC off platform?
@@JFoxUK hey thanks for Prompt response.
I was asking for the scenario when we want to use empApi in Experience cloud.
We had a custom LWC based experience cloud site where we wanted to know the CDC event but unfortunately empAPI is not supported in Experience cloud at the moment.
Hope you got my situation?
@@akashdeep8229 There are workarounds to that where I have seen people try to make a CometD client in an LWC to subscribe etc, though you may be best just using your LWC to poll a record for the change via Apex.
@@JFoxUKThanks,
Yeah, I went through these workarounds.
CometD : Enterprise won't approve it for Prod because of 3rd party library.
Polling: This will have significant impact on the performance if we poll using setInterval.
As Pub/sub api is getting away from cometD I was just guessing if we can use it in LWC like ui/api.