Server-Side Subscriptions

A device can subscribe to the messages from another device. This allows for messages to be forwarded from one device to another.

🚧

Security Configuration

The device must have the appropriate whitelists configured in order to allow message forwarding.

🚧

Subscriptions

The device must have the appropriate subscriptions configured in order to allow message forwarding. For example, if you want a webhook to fire on message received, you will create a message.recevied subscription to yourself.

Version 2.0 Subscription Types:

  • broadcast.received: subscribe to broadcast messages received from other devices
  • broadcast.sent: subscribe to broadcast messages sent from the current device
  • configure.received: subscribe to config messages received from other devices
  • configure.sent: subscribe to configure messages sent from the current device
  • message.received: subscribe to messages received from other devices
  • message.sent: subscribe to messages sent by the current device
  • unregister.received: subscribe to unregister events received from other devices
  • unregister.sent: subscribe to unregister events sent by the current device

Example

device-b would like to receive all messages sent by device-a

Ensure that device-b is in device-a message.sent whitelist.

{
  "uuid": "device-a",
  "meshblu": {
    "version": "2.0.0",
    "whitelists": {
      "message": {
        "sent": [
          {
            "uuid": "device-b"
          }
        ]
      }
    }
  }
}

You'll need two subscriptions to make this work properly. First, device-b must subscribe to device-a message.sent

{
  "emitterUuid": "device-a",
  "subscriberUuid": "device-b",
  "type": "message.sent"
}

Second subscription is device-b must subscribe to it's own message.received

{
  "emitterUuid": "device-b",
  "subscriberUuid": "device-b",
  "type": "message.received"
}

Use the Subscription API to manage your subscriptions.

For an easy-to-use example, please see https://github.com/octoblu/node-meshblu-firehose-socket.io/tree/master/examples.

👍

Circular Subscriptions

Meshblu will detect circular subscriptions to prevent infinite loops by checking the route property for repeated subscriptions.