I have noticed that if I subscribe to an event in the setup function, sometimes over time [days, weeks] it appears that the subscription may have been lost. The external observation is that I have one particle publishing events to a second particle. The second particle acknowledges the receipt of the event with a handshake by publishing an event which the first particle subscribes to. All works for awhile [days,weeks] and then stops working. Reflashing one or both particles fixes the problem. I have not tried the dash board to see if the original event from first particle is successfully published or not.
I presume a subscription would persist through a cloud “restart” or other networking issue?
I am having a similar issue with particle.subscribe. It appears that even a short blip in internet connectivity causes the subscription to be lost forever, until you reset the device.
There was an old firmware bug where the firmware would not notify the cloud of its subscriptions if the device lost its cloud connection and had to start a new session. This is due to the setup function not being run again on disconnect / reconnect. The best solution was to have the firmware send the subscription notifications again on reconnect…
I think we had planned to fix this in firmware (cc @mdma / @BDub), lets see if they have more recent insights.
I’ve noticed a similar issue. Would be great if this could get fixed.
I thought I had read there was a finite (and small) number of times you could re-run particle.subscribe. Is this not the case? Do you happen to have a link to the logic used to check if the subscription has been lost?
FWIW, I have been waiting for almost a year for this to be fixed. I gave up long ago and just perform a System.reset() if I haven’t heard data from my subscriptions in awhile. Crude, but it overcomes the issue.
This has been fixed in the 0.4.x line - if you flash your firmware with a recent version the problem should go away.
Internally the firmware does resend the subscriptions when the connection drops.
Thanks @Dave I wasn’t aware of the fix.
Awesome, thanks for confirming! I had thought this was fixed, but wasn’t sure when it was reported.
I’ve only been using the latest firmware, but still experience the issue. I have implemented a System.reset() in the meantime, but can recreate the issue on demand by dropping network temporarily and re-connecting. Is there something I can do to check if Particle.subscribe is being re-run?
I may have identified another possibility causing my issues, I will test it for a few days. (Related to how my code handles dates).