Register

Register a new device record

Register a new device with the Meshblu registry.

Event: "register", params, callback

  • params A device object. May not include a uuid or token. All other properties will be saved to the device on creation. For a description of the properties that will affect how Meshblu interacts with the device, see the core Meshblu documentation. If a uuid and/or token is provided, it will be ignored.
  • callback Function that is called with a device on registration
    • device The newly registered Meshblu device. Make sure to save the uuid and token. The token will not be made available again as it is not stored in plain-text anywhere by Meshblu.

🚧

Lock it down

The Socket.io implementation of Meshblu creates open devices using the old (deprecated) whitelists by default. This is to preserve backwards compatibility. It is strongly recommended to register devices with explicitly locked down version 2.0.0 whitelists instead by creating a v2.0.0 device (see the second example).

❗️

Save that Token

Device registration is the only time your token will be given to you. Be sure to keep it somewhere safe as the token is required to update your device in the future.

Open Response

When called with no arguments:

{
  "discoverWhitelist": [
    "*"
  ],
  "configureWhitelist": [
    "*"
  ],
  "sendWhitelist": [
    "*"
  ],
  "receiveWhitelist": [
    "*"
  ],
  "uuid": "5c7392dc-a4ba-4b5a-8c84-5934a3b3678b",
  "online": false,
  "token": "9e78f644a866e1b5b71d0a2dde912e8662477abf",
  "meshblu": {
    "createdAt": "2016-05-20T22:10:23+00:00",
    "hash": "kt8lmSb5r6ruHG41jqZZHp1CEQvzM1iMJ/kAUppryZo="
  }
}

Locked Down Response

When called with {"meshblu": {"version": "2.0.0"}}

{
  "uuid": "5c7392dc-a4ba-4b5a-8c84-5934a3b3678b",
  "online": false,
  "token": "9e78f644a866e1b5b71d0a2dde912e8662477abf",
  "meshblu": {
    "version": "2.0.0",
    "createdAt": "2016-05-20T22:10:23+00:00",
    "hash": "kt8lmSb5r6ruHG41jqZZHp1CEQvzM1iMJ/kAUppryZo="
  }
}