Skip to content

Commit

Permalink
Calls client.onHeartbeatTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
mtharrison committed May 2, 2018
1 parent d72a6f3 commit f428d11
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
11 changes: 10 additions & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [`client.onError`](#clientonerror)
- [`client.onConnect`](#clientonconnect)
- [`client.onDisconnect`](#clientondisconnect)
- [`client.onHeartbeatTimeout`](#clientonheartbeattimeout)
- [`client.onUpdate`](#clientonupdate)
- [`await client.connect([options])`](#await-clientconnectoptions)
- [`await client.disconnect()`](#await-clientdisconnect)
Expand Down Expand Up @@ -223,7 +224,7 @@ Iterates over all connected sockets, optionally filtering on those that have sub
a given subscription. This operation is synchronous.
- `each` - Iteration method in the form `function(socket)`.
- `options` - Optional options object
- `subscription` - When set to a string path, limits the results to sockets that are
- `subscription` - When set to a string path, limits the results to sockets that are
subscribed to that path.
- `user` - optional user filter. When provided, the `each` method will be invoked with
authenticated sockets with `credentials.user` equal to `user`. Requires the subscription
Expand Down Expand Up @@ -328,6 +329,14 @@ where:
- `reason` - a human-readable text explaining the reason for closing.
- `wasClean` - if `false`, the socket was closed abnormally.

### `client.onHeartbeatTimeout`

A property used to set a handler for heartbeat timeout events with the signature `function(willReconnect)`
where:
- `willReconnect` - a boolean indicating if the client will automatically attempt to reconnect.

Upon heartbeat timeout, the client will disconnect the websocket. However, the `client.onDisconnect()` property will only be called (if set) once the server has completed the closing handshake. Users may use this property to be notified immediately and take action (e.g. display a message in the browser).

### `client.onUpdate`

A property used to set a custom message handler with the signature `function(message)`. Invoked whenever
Expand Down
2 changes: 1 addition & 1 deletion dist/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f428d11

Please sign in to comment.