Skip to content

How to detect a user is offline when using liveQuery in a realtime chat app #1906

Closed
@westhacker

Description

@westhacker

I am using live queries to realize the realtime chat app, but I could not find the method to detect a user is online or offline. I am also confused with the enter and leave events.

subscription.on('enter', (object) => {
  console.log('object entered');
});

When an existing ParseObject's old value does not fulfill the ParseQuery but its new value fulfills the ParseQuery, you'll get this event. The object is the ParseObject which enters the ParseQuery. Its content is the latest value of the ParseObject.

subscription.on('leave', (object) => {
  console.log('object left');
});

When an existing ParseObject's old value fulfills the ParseQuery but its new value doesn't fulfill the ParseQuery, you'll get this event. The object is the ParseObject which leaves the ParseQuery. Its content is the latest value of the ParseObject.

I wonder when to trigger these two events. Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions