{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"How They Work","type":"basic","slug":"how-forwarders-work","excerpt":"","body":"Currently Meshblu supports two types of forwarders, [Meshblu](doc:forwarding-meshblu-2-0) and [Webhook](doc:forwarding-webhook-2-0). When a Meshblu device emits a message, broadcast, or configuration change, Meshblu will automatically forward the message to another Meshblu device or a webhook. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Webhook Example\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/0Y1570ovSHG9xfZHNKVB_Forwarders%20Webhook.svg\",\n        \"Forwarders Webhook.svg\",\n        \"0\",\n        \"0\",\n        \"#323232\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nIn this case, `Device A` has a forwarder set up to a web service (e.g. Github or Slack). The web service will receive a HTTP `POST` request containing the message as the HTTP body and metadata as `X-MESHBLU` headers.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"meshblu\\\": {\\n    \\\"forwarders\\\": {\\n      \\\"broadcast\\\": {\\n\\t\\t\\t\\t\\\"sent\\\": [\\n        \\t{\\n      \\t\\t\\t\\\"type\\\": \\\"webhook\\\",\\n          \\t\\\"url\\\": \\\"http://requestb.in/18gkt511\\\",\\n          \\t\\\"method\\\": \\\"POST\\\"\\n        \\t}\\n    \\t\\t]\\n      }\\n    }\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Meshblu Example\"\n}\n[/block]\nMeshblu forwarders allow a message to be mapped into a message of a different type.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/vTir38ylR5OhVQjXbKiV_Forwarders%20Meshblu%20Simple.svg\",\n        \"Forwarders Meshblu Simple.svg\",\n        \"0\",\n        \"0\",\n        \"#323232\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n`Device A` will send a broadcast, that will be transformed into a `message.sent` from `Device A`. `Device B` will then receive a copy of that message sent from `Device A`.","updates":[],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"573b9385e12384200070d58f","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Message Forwarders","slug":"forwarding","order":4,"from_sync":false,"reference":false,"_id":"573b93514e029d19000b8669","project":"5564f26a1fd04c0d00dc9aaa","createdAt":"2016-05-17T21:55:29.422Z","version":"5564f26a1fd04c0d00dc9aad","__v":0},"createdAt":"2016-05-17T21:56:21.844Z","githubsync":"","parentDoc":null,"user":"5564f227f0f70f0d00a9ab20","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5564f26b1fd04c0d00dc9aae","556741d17acd550d0075eaca","556741d87acd550d0075eacb","556742f87acd550d0075ead1","556781cd6976ef0d0099c545","5568d666d33aad0d00ec8d2e","557f6b2d38249b0d00d0d12b","55b67be9c2e909190073ed38","564e56c601e80e0d00396684","56731b714b2a680d00524daf","573612ac652bd80e00a90027","57365e2cf8ebd31700769f50","57366131f8ebd31700769f58","573b93514e029d19000b8669","573bbfdb7ac6f6170033bd35"],"_id":"5564f26a1fd04c0d00dc9aad","createdAt":"2015-05-26T22:23:38.671Z","project":"5564f26a1fd04c0d00dc9aaa","releaseDate":"2015-05-26T22:23:38.671Z","__v":15},"project":"5564f26a1fd04c0d00dc9aaa","__v":9}
Currently Meshblu supports two types of forwarders, [Meshblu](doc:forwarding-meshblu-2-0) and [Webhook](doc:forwarding-webhook-2-0). When a Meshblu device emits a message, broadcast, or configuration change, Meshblu will automatically forward the message to another Meshblu device or a webhook. [block:api-header] { "type": "basic", "title": "Webhook Example" } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/0Y1570ovSHG9xfZHNKVB_Forwarders%20Webhook.svg", "Forwarders Webhook.svg", "0", "0", "#323232", "" ] } ] } [/block] In this case, `Device A` has a forwarder set up to a web service (e.g. Github or Slack). The web service will receive a HTTP `POST` request containing the message as the HTTP body and metadata as `X-MESHBLU` headers. [block:code] { "codes": [ { "code": "{\n \"meshblu\": {\n \"forwarders\": {\n \"broadcast\": {\n\t\t\t\t\"sent\": [\n \t{\n \t\t\t\"type\": \"webhook\",\n \t\"url\": \"http://requestb.in/18gkt511\",\n \t\"method\": \"POST\"\n \t}\n \t\t]\n }\n }\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Meshblu Example" } [/block] Meshblu forwarders allow a message to be mapped into a message of a different type. [block:image] { "images": [ { "image": [ "https://files.readme.io/vTir38ylR5OhVQjXbKiV_Forwarders%20Meshblu%20Simple.svg", "Forwarders Meshblu Simple.svg", "0", "0", "#323232", "" ] } ] } [/block] `Device A` will send a broadcast, that will be transformed into a `message.sent` from `Device A`. `Device B` will then receive a copy of that message sent from `Device A`.