{"_id":"573b933952b0401900054c1c","user":"5564f227f0f70f0d00a9ab20","__v":8,"project":"5564f26a1fd04c0d00dc9aaa","version":{"_id":"5564f26a1fd04c0d00dc9aad","project":"5564f26a1fd04c0d00dc9aaa","__v":15,"createdAt":"2015-05-26T22:23:38.671Z","releaseDate":"2015-05-26T22:23:38.671Z","categories":["5564f26b1fd04c0d00dc9aae","556741d17acd550d0075eaca","556741d87acd550d0075eacb","556742f87acd550d0075ead1","556781cd6976ef0d0099c545","5568d666d33aad0d00ec8d2e","557f6b2d38249b0d00d0d12b","55b67be9c2e909190073ed38","564e56c601e80e0d00396684","56731b714b2a680d00524daf","573612ac652bd80e00a90027","57365e2cf8ebd31700769f50","57366131f8ebd31700769f58","573b93514e029d19000b8669","573bbfdb7ac6f6170033bd35"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"parentDoc":null,"category":{"_id":"573b93514e029d19000b8669","project":"5564f26a1fd04c0d00dc9aaa","version":"5564f26a1fd04c0d00dc9aad","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-05-17T21:55:29.422Z","from_sync":false,"order":4,"slug":"forwarding","title":"Message Forwarders"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-17T21:55:05.550Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"Meshblu will automatically re-emit a message as a new message from the forwarded device. Unlike subscriptions, this allows you to map a message of one type into a new type. \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/RI5KReuvTBuAl54zBDHV_Forwarders%20Meshblu.svg\",\n        \"Forwarders Meshblu.svg\",\n        \"0\",\n        \"0\",\n        \"#323232\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nMeshblu currently supports forwarding the following event types:\n - broadcast.received\n - configure.received\n - unregister.received\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"meshblu\\\": {\\n    \\\"forwarders\\\": {\\n    \\t\\\"broadcast\\\": {\\n      \\t\\\"received\\\": [\\n          {\\n            \\\"type\\\": \\\"meshblu\\\"\\n          }\\n        ]\\n      }\\n    }\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nThis would allow any broadcast received to be re-emitted as a new message from the device.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Forwarded Routes\"\n}\n[/block]\nEach time a message is forwarded the entire `route` is appended to the `forwardedRoutes` property in chronological order. The first route in the list is the origin of the message. The from in the first route in the list is the originator of the message. This allows you to see the history of how this message was received, including [subscriptions](doc:subscriptions-2-0).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"metadata\\\": {\\n    \\\"forwardedRoutes\\\": [\\n      [\\n      \\t{\\n        \\t\\\"from\\\": \\\"Device A\\\",\\n        \\t\\\"to\\\": \\\"Device A\\\",\\n        \\t\\\"type\\\": \\\"broadcast.sent\\\"\\n      \\t},\\n      \\t{\\n        \\t\\\"from\\\": \\\"Device A\\\",\\n        \\t\\\"to\\\": \\\"Device B\\\",\\n        \\t\\\"type\\\": \\\"broadcast.received\\\"\\n      \\t}\\n    \\t],\\n      [\\n        {\\n          \\\"from\\\": \\\"Device B\\\",\\n          \\\"to\\\": \\\"Device C\\\",\\n          \\\"type\\\": \\\"message.sent\\\"\\n        },\\n        {\\n          \\\"from\\\": \\\"Device C\\\",\\n          \\\"to\\\": \\\"Device C\\\",\\n          \\\"type\\\": \\\"message.received\\\"\\n        }\\n      ]\\n    ],\\n    \\\"route\\\": [\\n    \\t{\\n        \\\"from\\\": \\\"Device B\\\",\\n        \\\"to\\\": \\\"Device C\\\",\\n        \\\"type\\\": \\\"message.sent\\\"\\n      },\\n      {\\n        \\\"from\\\": \\\"Device C\\\",\\n        \\\"to\\\": \\\"Device C\\\",\\n        \\\"type\\\": \\\"message.received\\\"\\n      }\\n    ]\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Circular Forwarders\",\n  \"body\": \"Meshblu will detect circular forwarders to prevent infinite loops by looking at the `forwardedRoutes` property.\"\n}\n[/block]","excerpt":"","slug":"forwarding-meshblu-2-0","type":"basic","title":"Forwarding 2.0: Meshblu"}

Forwarding 2.0: Meshblu


Meshblu will automatically re-emit a message as a new message from the forwarded device. Unlike subscriptions, this allows you to map a message of one type into a new type. [block:image] { "images": [ { "image": [ "https://files.readme.io/RI5KReuvTBuAl54zBDHV_Forwarders%20Meshblu.svg", "Forwarders Meshblu.svg", "0", "0", "#323232", "" ] } ] } [/block] Meshblu currently supports forwarding the following event types: - broadcast.received - configure.received - unregister.received [block:code] { "codes": [ { "code": "{\n \"meshblu\": {\n \"forwarders\": {\n \t\"broadcast\": {\n \t\"received\": [\n {\n \"type\": \"meshblu\"\n }\n ]\n }\n }\n }\n}", "language": "json" } ] } [/block] This would allow any broadcast received to be re-emitted as a new message from the device. [block:api-header] { "type": "basic", "title": "Forwarded Routes" } [/block] Each time a message is forwarded the entire `route` is appended to the `forwardedRoutes` property in chronological order. The first route in the list is the origin of the message. The from in the first route in the list is the originator of the message. This allows you to see the history of how this message was received, including [subscriptions](doc:subscriptions-2-0). [block:code] { "codes": [ { "code": "{\n \"metadata\": {\n \"forwardedRoutes\": [\n [\n \t{\n \t\"from\": \"Device A\",\n \t\"to\": \"Device A\",\n \t\"type\": \"broadcast.sent\"\n \t},\n \t{\n \t\"from\": \"Device A\",\n \t\"to\": \"Device B\",\n \t\"type\": \"broadcast.received\"\n \t}\n \t],\n [\n {\n \"from\": \"Device B\",\n \"to\": \"Device C\",\n \"type\": \"message.sent\"\n },\n {\n \"from\": \"Device C\",\n \"to\": \"Device C\",\n \"type\": \"message.received\"\n }\n ]\n ],\n \"route\": [\n \t{\n \"from\": \"Device B\",\n \"to\": \"Device C\",\n \"type\": \"message.sent\"\n },\n {\n \"from\": \"Device C\",\n \"to\": \"Device C\",\n \"type\": \"message.received\"\n }\n ]\n }\n}", "language": "json" } ] } [/block] [block:callout] { "type": "success", "title": "Circular Forwarders", "body": "Meshblu will detect circular forwarders to prevent infinite loops by looking at the `forwardedRoutes` property." } [/block]