4

Are they diffrerent or same? I just started knowing this technology and wanted to know if it is enough to learn only one of it

1 Answer 1

8

They are different. Let's see how:-

  1. Use Lightning message service to communicate across the DOM between Visualforce pages, Aura components, and Lightning web components, including components in a pop-out utility bar.
  2. Use platform events to connect business processes in Salesforce and external sources through the exchange of real-time event data.
  3. It means you can use Lightning Message service only in Vf pages and lightning components whereas platform events can be used with Apex, triggers, Lightning Flows, process builders and external systems.
  4. Lightning Message Service is a front-end service that works in client-side user interfaces, which would include popped out utility bar item windows and parent/child iFrame windows (primarily Visualforce). All interactions have to originate from the same Lightning Experience application instance — i.e. same browser tab.
  5. A lot of things can be done using platform events which cannot be done using Lightning message service. For example, watch this video on Overcome Salesforce Governor Limits Using Platform Events

Read about them more here:-

4
  • Can i refrain using pub sub and just always use lightning message service when working on lightning component communication?
    – Ian Roque
    Aug 19, 2020 at 12:09
  • 1
    pubsub was never the right solution. Pubsub was restricted to one page whereas message service will work across the pages Aug 19, 2020 at 13:51
  • 2
    When you say across pages, Do you mean Lightning page with two different VF pages? What are other scenarios that come under across pages functionality?
    – javanoob
    Aug 19, 2020 at 15:22
  • If we have 2 users working at the same time with our application, would they be able "get" LMS messages of each other? E.g. first one adds new contact to the list, and in browser of the second user "list component" is refreshed to show newly added contact? Or is all this LMS thing works only in scope of "one browser"?
    – wesaw
    Jun 28 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.