Skip to main content

#PubSub Model0 人正在讨论

 

Hello Everyone,

 

1. We can use Pub-Sub to communicate between un-related components by using a custom library / code.

2. LMS is built-in framework by Salesforce to communicate between un-related components.

3. In this case what is the difference between Pub-Sub and LMS. In Salesforce documentation I can see this line "The advantage over pubsub is that message channels aren’t restricted to a single page".

4. But it was not working, when I try to establish a communication between two different components on two different pages.

 

Can you please help me to understand what they are trying to say in this documentation.

 

Link : https://developer.salesforce.com/docs/platform/lwc/guide/events-pubsub.html

 

What is the Difference between Lightning Message Service and Pub-Sub

 

#Lightning Message Service  #Lms  #Salesforce Developers  #Architects  #Salesforce  #Salesforce Developer  #PubSub Model

3 个回答
  1. 2024年2月15日 07:52

    Hi @VIGNESH BALASUBRAMANIAN,

    The Pub-Sub pattern in LWC was initially used for event communication between unrelated components on the same Lightning page.

     

    LMS  allows communication between components across different pages and also between Visualforce pages and various types of Lightning components, including LWCs and Aura components.

    Please review the following blog posts for a clearer grasp of LMS and the Pub-Sub pattern, illustrated with examples:

    https://www.sfdcblogs.com/post/lightning-message-service-lms-in-lwc

    https://santanuboral.blogspot.com/2019/09/LWC-drag-n-drop-pub-sub.html 

    https://santanuboral.blogspot.com/2021/02/lms-with-lwc.html  

     

    Hope this helps you. Thanks

0/9000