Constructor
new LiveQueryClient(options)
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object
|
|
Methods
(async) close() → {Promise|undefined}
This method will close the WebSocket connection to this LiveQueryClient, cancel the auto reconnect and unsubscribe all subscriptions based on it.
Returns:
- Type:
-
Promise
|undefined
open()
After open is called, the LiveQueryClient will try to send a connect request to the LiveQuery server.
subscribe(query, sessionToken) → {LiveQuerySubscription|undefined}
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.
Parameters:
Name | Type | Description |
---|---|---|
query |
ParseQuery
|
the ParseQuery you want to subscribe to |
sessionToken |
string
|
(optional) |
Returns:
- Type:
-
LiveQuerySubscription
|undefined
(async) unsubscribe(subscription) → {Promise|undefined}
After calling unsubscribe you'll stop receiving events from the subscription object.
Parameters:
Name | Type | Description |
---|---|---|
subscription |
object
|
subscription you would like to unsubscribe from. |
Returns:
- Type:
-
Promise
|undefined