Filter/don't send LiveQuery events triggered by the same client

After going through the source code and documentation I understood that it is not possible to clarify what client installation is triggering the live query event. Could you please confirm or correct me?

The code is taking the client session and installation from the subscription itself and not from the save/delete request on that particular object, am I right? So there is nothing to compare in the trigger code to set sendEvent = false

Parse.Cloud.afterLiveQueryEvent('MyObject', async (request) => {
  if (...???...)  {
    request.sendEvent = false;

What I would like to achieve… Multiple users (or the same user from multiple devices) are subscribed on the same document and one of the user updates it. Then all devices/users except the one modifying it would get a liveQuery trigger.

Or is there a way in ParseSwift SDK how to ignore/filter events triggered by that client SDK?
How could I avoid that liveQuery callbacks in the client SDK would cause an update in client twice:
…update in client → save in Parse Server → liveQuery → update in client

There is no such option. All clients will receive the events, including the one that changed the data. You’d need to create your own custom logic to ignore it in the client side.

1 Like

Thank you for confirmation, I will have a look if updatedAt in trigger event would be close enough to the save response :thinking:

just a quick follow-up for anyone who might find it useful. It seems that ParseSwift SDK returns in the .save() response exactly the same updatedAt date as the one that come from LiveQuery trigger, even I tried to modify the objects im between:

profile saved: PrsProfile ({“updatedAt”:{"__type":“Date”,“iso”:“2021-05-30T09:07:56.556Z”},… )

Updated: PrsProfile ({“updatedAt”:{"__type":“Date”,“iso”:“2021-05-30T09:07:56.556Z”},…)

As it is in milliseconds precision, I think it is safe to assume that there won’t be another updates with the same updateAt and therefore safe to use to filter out updates triggered by the device client itself.