Newer Version Available
Subscribe to a Message Channel
Example
In this example, we define an Aura component called myNewComponent that contains the custom message channel, SampleMessageChannel__c. The lightning:messageChannel component's onMessage attribute calls the handleChanged method in the client-side controller.
- Standard navigation tabs
- Console navigation workspace tabs
- Console navigations subtabs
- Console navigation items
The component myNewComponent detects a new message and updates the display value.
Write the handler in your component's client-side controller. The handleChanged method fires when there is a new message. It checks whether there is a payload in the message, and if so, assigns the new data to the v.recordValue attribute. The lightning:formattedText element updates to display the new value.