Parse. LiveQueryClient

Creates a new LiveQueryClient. Extends events.EventEmitter cloud functions.

A wrapper of a standard WebSocket client. We add several useful methods to help you connect/disconnect to LiveQueryServer, subscribe/unsubscribe a ParseQuery easily.

javascriptKey and masterKey are used for verifying the LiveQueryClient when it tries to connect to the LiveQuery server

We expose three events to help you monitor the status of the LiveQueryClient.

let Parse = require('parse/node');
let LiveQueryClient = Parse.LiveQueryClient;
let client = new LiveQueryClient({
  applicationId: '',
  serverURL: '',
  javascriptKey: '',
  masterKey: ''

Open - When we establish the WebSocket connection to the LiveQuery server, you'll get this event.

client.on('open', () => {


Close - When we lose the WebSocket connection to the LiveQuery server, you'll get this event.

client.on('close', () => {


Error - When some network error or LiveQuery server error happens, you'll get this event.

client.on('error', (error) => {



new LiveQueryClient(options)

Name Type Description
options Object
Name Type Description
applicationId string

applicationId of your Parse app

serverURL string

the URL of your LiveQuery server

javascriptKey string


masterKey string

(optional) Your Parse Master Key. (Node.js only!)

sessionToken string




This method will close the WebSocket connection to this LiveQueryClient, cancel the auto reconnect and unsubscribe all subscriptions based on it.


After open is called, the LiveQueryClient will try to send a connect request to the LiveQuery server.

subscribe(query, sessionToken) → {Object}

Subscribes to a ParseQuery

If you provide the sessionToken, when the LiveQuery server gets ParseObject's updates from parse server, it'll try to check whether the sessionToken fulfills the ParseObject's ACL. The LiveQuery server will only send updates to clients whose sessionToken is fit for the ParseObject's ACL. You can check the LiveQuery protocol here for more details. The subscription you get is the same subscription you get from our Standard API.

Name Type Description
query Object

the ParseQuery you want to subscribe to

sessionToken string





After calling unsubscribe you'll stop receiving events from the subscription object.

Name Type Description
subscription Object

subscription you would like to unsubscribe from.