{"__v":2,"_id":"57439faceed4ab0e00edc741","category":{"__v":16,"_id":"5567425a1c38390d0069808b","pages":["5567425c1c38390d0069808d","558f782c1311b80d00ba9d97","558f7986f795be2d00c1164f","558f8069f795be2d00c11655","558f810bf795be2d00c11657","558f82e11311b80d00ba9da1","558f850df795be2d00c1165b","558f85401311b80d00ba9da3","558f85df1311b80d00ba9da5","558f87726742610d0051c4f5","558f87f26742610d0051c4f7","558f886df795be2d00c1165f","55918fec5631432f002d357e","559191f34e50b50d0019612a","5592c8d89a68220d00f1c404","559efaebdf92223500dc50e7"],"project":"556742591c38390d00698087","version":"5567425a1c38390d0069808a","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-05-28T16:29:14.942Z","from_sync":false,"order":9999,"slug":"documentation","title":"Documentation"},"parentDoc":null,"project":"556742591c38390d00698087","user":"5564f227f0f70f0d00a9ab20","version":{"__v":2,"_id":"5567425a1c38390d0069808a","project":"556742591c38390d00698087","createdAt":"2015-05-28T16:29:14.412Z","releaseDate":"2015-05-28T16:29:14.412Z","categories":["5567425a1c38390d0069808b","57214d354758d90e009e6638"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-24T00:26:20.163Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"The `ready` event is emitted whenever the connection emits a valid `identity` and Meshblu accepts the credentials.\n\n* `response` Response of a successful authentication.\n  * `uuid` UUID of the device the connection is authenticated as.\n  * `token` Plain-text token of the device the connection is authenticated as. The `token` is passed through by the API so that it can be returned here, it is never stored as plain text by Meshblu.\n  * *(deprecated)* `api` A legacy identifier kept for backwards compatibility. Should not be used in any new projects.\n  * *(deprecated)* `status` A legacy status code kept for backwards compatibility. Should not be used in any new projects.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"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:\\n\\n* Messages sent to the device while it is reconnecting will not be delivered to the client.\\n* 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.\",\n  \"title\": \"Multiple \\\"ready\\\" events\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example ready\"\n}\n[/block]\nWhen a valid `identity` is accepted by Meshblu:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"uuid\\\": \\\"78159106-41ca-4022-95e8-2511695ce64c\\\",\\n  \\\"token\\\": \\\"d5265dbc4576a88f8654a8fc2c4d46a6d7b85574\\\",\\n  \\\"api\\\": \\\"connect\\\",\\n  \\\"status\\\": 201\\n}\\n\",\n      \"language\": \"json\",\n      \"name\": \"notReady-event.json\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"event-ready","type":"basic","title":"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. The `token` 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. [block:callout] { "type": "info", "body": "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:\n\n* Messages sent to the device while it is reconnecting will not be delivered to the client.\n* 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.", "title": "Multiple \"ready\" events" } [/block] [block:api-header] { "type": "basic", "title": "Example ready" } [/block] When a valid `identity` is accepted by Meshblu: [block:code] { "codes": [ { "code": "{\n \"uuid\": \"78159106-41ca-4022-95e8-2511695ce64c\",\n \"token\": \"d5265dbc4576a88f8654a8fc2c4d46a6d7b85574\",\n \"api\": \"connect\",\n \"status\": 201\n}\n", "language": "json", "name": "notReady-event.json" } ] } [/block]