From 14d8f5815e088fc80d31e2d02fb0993895cb0a39 Mon Sep 17 00:00:00 2001 From: Antonio Davi Macedo Coelho de Castro Date: Wed, 31 Jul 2019 01:41:34 -0700 Subject: [PATCH 1/2] Fix doc for creating a subscription in javascript --- _includes/js/live-queries.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/js/live-queries.md b/_includes/js/live-queries.md index 269802916..327059925 100644 --- a/_includes/js/live-queries.md +++ b/_includes/js/live-queries.md @@ -9,7 +9,7 @@ Note: Live Queries is supported only in [Parse Server](https://github.com/parse- ```javascript let query = new Parse.Query('Game'); -let subscription = query.subscribe(); +let subscription = await query.subscribe(); ``` The subscription you get is actually an event emitter. For more information on event emitter, check [here](https://nodejs.org/api/events.html). You'll get the LiveQuery events through this `subscription`. The first time you call subscribe, we'll try to open the WebSocket connection to the LiveQuery server for you. From b41c8bf86e911fd26cf974b2cd453081137ec986 Mon Sep 17 00:00:00 2001 From: Antonio Davi Macedo Coelho de Castro Date: Wed, 31 Jul 2019 01:51:14 -0700 Subject: [PATCH 2/2] Note about release 2.3.0 --- _includes/js/live-queries.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_includes/js/live-queries.md b/_includes/js/live-queries.md index 327059925..e463f659d 100644 --- a/_includes/js/live-queries.md +++ b/_includes/js/live-queries.md @@ -12,6 +12,8 @@ let query = new Parse.Query('Game'); let subscription = await query.subscribe(); ``` +* Since release `2.3.0` of Parse JS SDK, the `query.subscribe()` function returns a `Promise` that resolves to the subscription object. Previous releases return the subscription object directly and require you to write `let subscription = query.subscribe();` instead. + The subscription you get is actually an event emitter. For more information on event emitter, check [here](https://nodejs.org/api/events.html). You'll get the LiveQuery events through this `subscription`. The first time you call subscribe, we'll try to open the WebSocket connection to the LiveQuery server for you. ## Event Handling