In Salesforce Lightning Web Components (LWC), when you want to communicate between independent components (not parent-child), the best tool is Lightning Message Service (LMS). In this blog post, we'll build a real-time text sharing example where: One component (textPublisher) lets the user type a message. Another component (textSubscriber) receives and displays the message instantly. These components are not nested and exist independently on the same page.

May 4, 2025 - 09:56
 0

In Salesforce Lightning Web Components (LWC), when you want to communicate between independent components (not parent-child), the best tool is Lightning Message Service (LMS).

In this blog post, we'll build a real-time text sharing example where:

  • One component (textPublisher) lets the user type a message.
  • Another component (textSubscriber) receives and displays the message instantly.
  • These components are not nested and exist independently on the same page.