Skip to main content

#Lms0 discussing

 

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 answers
  1. Feb 15, 2024, 7:52 AM

    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