-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
executable file
·37 lines (30 loc) · 1.03 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var cloudilly= require("./hook.js");
var app= "<GET YOUR APP NAME AT CLOUDILLY.COM>";
var access= "<GET YOUR ACCESS KEY AT CLOUDILLY.COM>";
cloudilly.initialize(app, access, function() {
cloudilly.connect();
});
cloudilly.socketConnected(function(err, res) {
if(err) { console.log("ERROR: Oops. Something wrong"); return; }
console.log("@@@@@@ CONNECTED");
console.log(res);
var beaconID= "<INSERT IDENTIFIER, FORMAT AS 'DINGDONG:MAJOR:MINOR', MAJOR / MINOR FROM ESTIMOTE CLOUD>";
var secretToken= "<INSERT YOUR OWN SECRET TOKEN>";
cloudilly.create(beaconID, secretToken, function(err, res) {
if(err) { console.log("ERROR: Oops. Something wrong"); return; }
console.log("@@@@@@ CREATE");
console.log(res);
cloudilly.disconnect();
});
});
cloudilly.socketDisconnected(function() {
console.log("@@@@@@ CLOSED");
});
cloudilly.socketReceivedDevice(function(res) {
console.log("@@@@@@ RECEIVED DEVICE");
console.log(res);
});
cloudilly.socketReceivedPost(function(res) {
console.log("@@@@@@ RECEIVED POST");
console.log(res);
});