Anybody experienced a publish not be received when all else appears to be well?

Has anybody experienced sending a PUBLISH to the cloud from a Photon (and knowing it made it to the cloud, because you saw it appear on the console) only for it to not be received on another Photon, despite neither Photon appearing to have any connectivity woes? i.e. no flashing LED and no recent handshake timestamp?

So this is a case of Particle.subscribe() not working, rather than Publish?
What does the code on either end look like?


The most likely cause is an incompatiblity between the scope of your publish and your subscribe instructions (PRIVATE -> MY_DEVICES vs. PUBLIC -> ALL_DEVICES).


Thanks, ScruffR, I’m doing…

Particle.subscribe(DEVICE_NAME, eventHandler, MY_DEVICES);


Particle.publish(DEVICE_NAME, MY_MSSG, 60, PRIVATE);`

@netpex, you might want to share some code.

OK. I will. It’s just with my code being dependant on libraries I’m not really sure how to post it in a way that isn’t really messy.

Also, as this is an intermittent problem, I suspect it might be network related somehow rather than code related. I’ve just tried again and everything works as it has for the last year. It was just this morning when it would not work but the devices themselves weren’t showing any outward signs of network disruption.

@netpex, if you using the Web IDE, you can just share the application. Otherwise, there is no “guarantee” that a subscribing device will receive the publish, only that the Cloud received it if the publish ACK is not disabled. A guarantee would require the subscribing device to publish an ACK-type message that the publishing device can receive. If it is not received within a certain time period, the device can republish.

Thanks, @peekay123, I’m not using the web IDE I’m using the CLI.

I guess I will have to put this morning down to a weird time/space anomaly. I don’t think there’s anything wrong with my code. It’s worked reliably for months. Just odd that it’s been misbehaving today. Maybe there’s a lot of WiFi interference today round my gaff?

I’ll have to look into coding up some device->device confirmation gubbins - unless anyone has an example already cooked up they don’t mind sharing? Thanks again

1 Like