Barracks Messaging SDK for Javascript (Beta)
The Javascript SDK to enable messaging on your devices
Installation
$ npm install barracks-messenger-sdk-betatest
Usage
Create a Barracks Messaging SDK instance :
var BarracksMessenger = BarracksMessenger; var barracksMessenger = apiKey: 'Your user API key' unitId: 'The unique device identifier';
Your user API key you can be found on the Account page of the Barracks application.
Connect to the messaging service :
barracksMessenger;
Subscribe to a topic to enable message reception :
barracksMessenger;
A message object has 5 properties :
- payload : String
- retained : boolean
- topic : String
- length : int
- qos : 0 or 1 (2 is not supported yet)
End the connection :
barracksMessenger;
Docs & Community
- Website and Documentation
- Github Organization for other official SDKs