Hello there,
I have a situation where I need the subscribe handler to be triggered by Particle.publish() during setup(). I register the Particle.subscribe() handler in setup(), and the handler is triggered fine if I publish the event during loop(). But it does not work if Particle.publish() is called in setup()…
To be more clear with my issue:
This works:
void setup() {
Particle.subscribe("prefix", myHandler);
}
void loop() {
Particle.publish("prefix/real-thing", "hello", PRIVATE); // this triggers myHandler
}
But this does not:
void setup() {
Particle.subscribe("prefix", myHandler);
waitUntil(Particle.connected); // even this does not help
...
Particle.publish("prefix/real-thing", "hello", PRIVATE); // this does NOT trigger myHandler unfortunately
}
void loop() {
....
}
If there is some way to fix this, that would be great! Or at least knowing this is intended would be helpful too.