SDK-Hardware Authentication
Just as the hardware authenticates with the Gumband Cloud, it also needs to authenticate with the SDK to ensure only expected hardware interacts with exhibits. The SDK gets the list of connected hardware from the Gumband Cloud, and then allows hardware to connect and authenticate with the same ID / token combination.
Available in version 1.0.31
and later in the Node.js SDK
SDK “Waiting for Auth” Queue
When the exhibit connection to the Gumband Cloud is pending or unstable, the following connections are added to a “Waiting for Authentication” queue until the SDK receives the connected hardware list from the Gumband Cloud. If the SDK does not receive that list within 10 sec
of the hardware connection, the SDK initiates a disconnection at which point the hardware would back off and retry. That cycle would continue until the SDK had the required hardware info and the hardware is able to successfully connect.
How Two MQTT Connections for the Same Hardware ID Respond
If two hardware connections authenticate with the same hardware ID, the SDK will respond in the following way:
If that hardware ID connection is “Waiting for Auth”, the SDK will disconnect the older connection and hold the newer connection for authentication.
If the hardware ID connection is authenticated, the SDK will reject the newer connection and hold the existing hardware connection.
Removing an Active SDK-Hardware Connection
If hardware is removed from an exhibit through the Gumband Cloud dashboard and is currently connected to the exhibit, it will be immediately disconnected and will not be allowed to further authenticate.
SDK Offline Mode
An SDK can operate in “offline mode” where it will blindly accept hardware based on hardware ID. Add the following lines to the SDK constructor:
{ noInternetConnection: true, noInternetHardwareIds: [100, 121, 10], // list hardware IDs to allow }
SDK HARDWARE_ONLINE
& HARDWARE_OFFLINE
Callbacks
I added a HARDWARE_ONLINE
callback for the SDK when the token is accepted and the SDK sends back true
on hardwareId/authenticate
. I also added a hardware "expiry" timeout that triggers a HARDWARE_OFFLINE
event in the SDK if the heartbeat for a particular harwareId
isn’t received within 20s
. The current docs have this heartbeat at 13s
per, is that accurate?