Created
May 3, 2016 18:35
-
-
Save chrismatthieu/5949e465e67f52134e7e30dbe65b9506 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create new device | |
// curl -X POST https://meshblu.octoblu.com/devices | |
// {"discoverWhitelist":["*"],"configureWhitelist":["*"],"sendWhitelist":["*"],"receiveWhitelist":["*"],"uuid":"ca9de188-23d7-4297-88d1-0e5c5badeb54","online":false,"token":"71790fd7b8cce3d4f882602df99f810466da30ca","meshblu":{"createdAt":"2016-05-03T18:27:20+00:00","hash":"OMxQuYtCA3ZZiNlpjeiuib+2EMXJC3ku9F0AJAp99Ls="}} | |
// Use the above UUID in the subscribe below | |
// Send a broadcast message from other device and you should receive it in on message below | |
// curl -X POST -H "Content-Type: application/json" -d '{"devices": "*", "payload": {"yellow":"off"}}' https://meshblu.octoblu.com/messages --header "meshblu_auth_uuid: ca9de188-23d7-4297-88d1-0e5c5badeb54" --header "meshblu_auth_token: 71790fd7b8cce3d4f882602df99f810466da30ca" | |
var meshblu = require('meshblu'); | |
var conn = meshblu.createConnection({ | |
"server": "meshblu.octoblu.com", | |
"port": 80 | |
}); | |
conn.on('notReady', function(data){ | |
console.log('UUID FAILED AUTHENTICATION!'); | |
console.log(data); | |
}); | |
conn.on('ready', function(data){ | |
console.log('UUID AUTHENTICATED!'); | |
console.log(data); | |
// setInterval(function(){ | |
// console.log("sending message"); | |
// conn.message({ | |
// "devices": data.uuid, | |
// "payload": { | |
// "hello":"world" | |
// } | |
// }); | |
// },300); | |
conn.subscribe({ | |
"uuid": "ca9de188-23d7-4297-88d1-0e5c5badeb54" | |
}, function (data) { | |
console.log(data); | |
}); | |
conn.on('message', function(data){ | |
console.log('message received'); | |
console.log(data); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HI Chris,
I would like to send message to my mobile thru Meshblu platform ..Yes I am able to do using SMS but I need to send messages between two mobile . Eg I have iPhone and iPad,each device has UUID ,is it possible to send message both the device.
Thanks,
Bala