I’ve been playing a bit with the publish and particle organisation part and designing our communications inside our device fleet.
Basically I’m trying to publish from server an event like “devicename-deviceid-timerdata” so I could then add subscription to each device to listen to “devicename-deviceid-” and easily relay all kinds of info`/settings back to the device. However it seems that if I publish from server it gets assigned coreid of 001 and name “cloud”.
This means that I can’t only listen to “my devices” from the device end but rather have to listen 001 which is public I assume. Also if I make the event private the device can’t see it. So it seems there’s no way to privately send data from cloud to the device via publish? I hope I’m mistaken?
I’m happy with the devices not seeing each others published data but I’d need some way to publish events from our server which can be seen only by our devices. Any ideas?
My code is written in Java (Apache Tomcat), but that’s not necessary; any language that can parse Server Sent Events (SSE) can be used. The stream of data that comes back from the Particle server continuously and basically instantaneously includes a block of JSON data when an event is published. It looks like this (from the docs):
The important thing is that it includes the coreid, which is the device ID of the device that sent it, so you don’t even need to put it in the event name or data. It should all be completely private and sounds like what you need.
you have to use following in the CLI when testing:
particle publish remoNave testinggg --private
And when not using MY_DEVICES you have to drop the --private… Mix and match didn’t work. Thanks! It thought they could be mixed as needed but apparently nope…