-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
34 lines (27 loc) · 859 Bytes
/
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
var app= "<INSERT YOUR APP IDENTIFIER>";
var access= "<INSERT YOUR ACCESS KEY>";
var cloudilly= require("./Cloudilly/hook.min.js");
cloudilly.initialize(app, access, function() {
cloudilly.connect();
});
cloudilly.socketConnected(function(err, res) {
if(err) { error("ERROR: SocketConnected"); return; }
console.log("SocketConnected");
cloudilly.listen("public", function(err, res) {
if(err) { console.log("ERROR: Listen"); return; }
return;
});
});
cloudilly.socketDisconnected(function() {
console.log("SocketDisconnected");
});
cloudilly.socketReceivedDevice(function(res) {
console.log("@@@@@@ RECEIVED DEVICE");
console.log(res);
// DO SOMETHING INTERESTING HERE
// IE, SEND OUT PUSH NOTIFICATION IF SOMEONE ENTERS PUBLIC
});
cloudilly.socketReceivedPost(function(res) {
console.log("@@@@@@ RECEIVED POST");
console.log(res);
});