Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse.Cloud.onLiveQueryEvent Documentation #666

Merged
merged 4 commits into from
Sep 17, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions _includes/cloudcode/cloud-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,37 @@ Parse.Cloud.beforeLogin(async request => {
- On sign up
- If the login credentials are incorrect

# LiveQuery Triggers

*Available only on parse-server cloud code starting 2.6.2*

Sometimes you may want monitor Live Query Event to be used with a 3rd Party such as datadog. The `onLiveQueryEvent` trigger can be logging events triggered, number of clients connected, number of subscriptions and errors.
dplewis marked this conversation as resolved.
Show resolved Hide resolved

```javascript
Parse.Cloud.onLiveQueryEvent(({
event,
clients,
subscriptions,
error
}) => {
if (event !== 'ws_disconnect') {
return;
}
// Do your magic
});
```

## Events

* connect
* subscribe
* unsubscribe
* ws_connect
* ws_disconnect
* ws_disconnect_error

"connect" differs from "ws_connect", the former means that the client completed the connect procedure as defined by Parse Live Query protocol, where "ws_connect" just means that a new websocket was created.

# Using the Master Key in cloud code
Set `useMasterKey:true` in the requests that require master key.

Expand Down