Skip to main content

Pub-Sub Pattern

Explore practical guides and implementation patterns for this topic.

Posts

Topic LWC
Lightning Web Components

Mastering Salesforce Lightning Message Service (LMS): The Pub-Sub Pattern in LWC

💬 In plain words: Lightning Message Service (LMS) is Salesforce's official "Publish-Subscribe" (Pub-Sub) framework. It acts like a radio station inside a Salesforce page. One component acts as the DJ, broadcasting a message, and any other component on the page can tune into that station to hear it. This allows unrelated components (even across LWC, Aura, and Visualforce) to talk to each other without needing a messy parent-child relationship. Before LMS, if you wanted a component in the left sidebar to update a component in the main page area, developers had to rely on complex URL hacks, window events, or unsupported custom Pub-Sub libraries. Lightning Message Service completely solved this by providing a secure, standardized, and metadata-driven messaging architecture built natively into the Salesforce platform.
Read article