{"__v":2,"_id":"57439ec1e42a590e00e26ef4","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:22:25.711Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"The `message` event is emitted whenever a device sends or receives a message. Use the [`conn.subscribe`](#connsubscribeparams) API to subscribe to `message` events for a device. In order to receive broadcast from a device, your connection must be authenticated as a device that is in the target device's `broadcast.sent` whitelist. To receive message sent by a device, your connection must be in the target's `message.sent` whitelist. To receive messages from other devices, they must be in the authorized device's `message.from` whitelist. See the [Meshblu whitelist documentation](https://meshblu.readme.io/docs/whitelists-2-0) for more information.\n\n* `message` Message object that was received.\n  * `devices` Array of UUIDs to whom the message was sent. It will contain the string `\"*\"`, If the message was a broadcast.\n  * `fromUuid` Uuid of the device that sent the message. Is set by Meshblu, so it can be trusted as long as it is verified that the message was received through Meshblu.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example message\"\n}\n[/block]\nWhen a device receives a broadcast message it is subscribed to:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"devices\\\": [\\n    \\\"*\\\"\\n  ],\\n  \\\"foo\\\": \\\"bar\\\",\\n  \\\"fromUuid\\\": \\\"1f6d9e7b-059b-4c1a-b699-708948ad8e10\\\"\\n}\\n\",\n      \"language\": \"json\",\n      \"name\": \"message-event.json\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"event-message","type":"basic","title":"Event: message"}
The `message` event is emitted whenever a device sends or receives a message. Use the [`conn.subscribe`](#connsubscribeparams) API to subscribe to `message` events for a device. In order to receive broadcast from a device, your connection must be authenticated as a device that is in the target device's `broadcast.sent` whitelist. To receive message sent by a device, your connection must be in the target's `message.sent` whitelist. To receive messages from other devices, they must be in the authorized device's `message.from` whitelist. See the [Meshblu whitelist documentation](https://meshblu.readme.io/docs/whitelists-2-0) for more information. * `message` Message object that was received. * `devices` Array of UUIDs to whom the message was sent. It will contain the string `"*"`, If the message was a broadcast. * `fromUuid` Uuid of the device that sent the message. Is set by Meshblu, so it can be trusted as long as it is verified that the message was received through Meshblu. [block:api-header] { "type": "basic", "title": "Example message" } [/block] When a device receives a broadcast message it is subscribed to: [block:code] { "codes": [ { "code": "{\n \"devices\": [\n \"*\"\n ],\n \"foo\": \"bar\",\n \"fromUuid\": \"1f6d9e7b-059b-4c1a-b699-708948ad8e10\"\n}\n", "language": "json", "name": "message-event.json" } ] } [/block]