Event: ready
The ready
event is emitted whenever the connection emits a valid identity
and Meshblu accepts the credentials.
response
Response of a successful authentication.uuid
UUID of the device the connection is authenticated as.token
Plain-text token of the device the connection is authenticated as. Thetoken
is passed through by the API so that it can be returned here, it is never stored as plain text by Meshblu.- (deprecated)
api
A legacy identifier kept for backwards compatibility. Should not be used in any new projects. - (deprecated)
status
A legacy status code kept for backwards compatibility. Should not be used in any new projects.
Multiple "ready" events
The
"ready"
event is emitted every time the connection is re-established. In normal network conditions, it is not uncommon the connection to occasionally drop and reestablish itself. In those cases, the library will re-authenticate and the brief outage will not be noticeable. Two things to note:
- Messages sent to the device while it is reconnecting will not be delivered to the client.
- Setting event listeners inside of the callback to the
"ready"
event is discouraged as they will be doubled up every time the event is fired. This may lead to functions being unexpectedly called multiple times for a single event. It presents itself as erratic behavior that appears to only happen after the connection has been established for a long time, and can therefore be very difficult to track down.
Example ready
When a valid identity
is accepted by Meshblu:
{
"uuid": "78159106-41ca-4022-95e8-2511695ce64c",
"token": "d5265dbc4576a88f8654a8fc2c4d46a6d7b85574",
"api": "connect",
"status": 201
}
Updated less than a minute ago