2

I have a requirement to send messages from LWC component to an Aura component. The component exist on the page independently, i.e LWC is not embedded in an aura component. The components are in a lightning community and the aura component is a part of page header and lwc component is placed in one of the detail page.

Is it possible through pubsub?

Note : I'm aware that the lightning message service is going to come in future release.

2

Lightning Message Service currently in BETA (as of Spring 20 , v49.0) seems to be a promising feature for this approach.

However if you want to roll your own then lwc-recipes repo has a simple pubsub library and also has sample recipe for communication between aura and lwc.

The samples can be found here

  1. Aura pubsub module
  2. Aura component as publisher
  3. Aura Component as subscriber

LWC Samples showing how to fire event and subscribe between

| improve this answer | |

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.