Closed anhldbk closed 6 years ago
Try "devices: "*"
@chrismatthieu The same thing. It does NOT work.
Sending messages to "*" devices only works for devices that are subscribing to the emitters UUID. Our subscription API is documented here - https://meshblu-socketio.readme.io/docs/subscribe
I mocked up the following demo for you to try - https://gist.github.com/chrismatthieu/5949e465e67f52134e7e30dbe65b9506
@chrismatthieu Thank you for the explanation! You're so kind.
The device must have the appropriate whitelists configured in order to allow message forwarding
, right?
So imagine we have a code like this one:
conn.on('ready', function(data){
console.log('UUID AUTHENTICATED!');
console.log(data);
setInterval(function(){
console.log("sending message");
conn.message({
"devices": "*",
"payload": {
"hello":"world"
}
});
},300);
conn.subscribe(config.uuid, function(data){ // the device subscribes to itself
console.log(data)
})
conn.on('message', function(data){
console.log('message received');
console.log(data);
});
});
Also the device is set up with the following property:
{
"receiveWhitelist": []
}
The property indicates that there's no device could receive messages from the device (including itself
)
To my surprise, the device still receive broadcast messages. Anything wrong?
I'm following the tutorial. Here the provided code to send periodical messages to the program itself:
But if I modify the message to send to all devices,
"devices": "all"
there's no message to receive.Would you pls tell me what wrong is?