Closed rizvanhaider closed 7 years ago
Hello Rizwan,
Instead of calling meshblu.createConnection, make your conn equal to a new meshblu, as show below:
var meshblu = require('meshblu');
// Not specifying a UUID/Token auto-registers a new device
var conn = new meshblu({
resolveSrv: true,
});
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.on('message', function(data){
console.log('message received');
console.log(data);
});
});
conn.connect();
Also note the last line, which actually starts the connection.
Regards, Andrew
after deplying meshblu locally,
running the blow script give the error :
TypeError: meshblu.createConnection is not a function at Object.<anonymous> (E:\iot\meshblu\ping.js:4:20) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3
ping.js
Arduino Tentacle sketch for esp8266 is here