2

Looking at using Platform Events to subscribe to particular updates in a Lightning Web Component.

A certain LWC component will only be interested in events that relate to that particular component.

E.g. an action is performed by the user that results in the synchronous creation of data, resulting in an sobject's Id being returned to the form.

An asynchronous update of that data is performed and a platform event is issued to state that the update is complete. That event contains the Id of the sobject that was updated.

The form subscribes to the event channel, but only wants to perform an action when the event with the correct Id specified is received.

At the moment it looks like we have to subscribe to ALL events on the channel, and filter out the ones we're interested in within the Javascript.

This would appear to have implications for:

  • Security - we are being told of all events, and a consumer could remove the filtering within the client javascript and see data for all events. Sharing on the sobject could resolve this, but it could be complex.

  • Performance - as more concurrent users of the LWC ramp up, the number of events being sent to each individual form also increases, putting load on the client form.

Is anyone aware of any way in which we can limit the number of events that the form subscribes to, without creating a multitude of channels (not feasible) and not performing the filtering on the client side?

1 Answer 1

0

Now, You can check this https://help.salesforce.com/s/articleView?id=release-notes.rn_platform_events_filtering_beta.htm&type=5&release=238 Events can be filtered based on filter expression on the channel.

1
  • Thanks. It's recommended that the salient points of the documentation are added into the answer in case the link becomes stale. May 24, 2022 at 15:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .