What would be best: WITH_ACK or bveenema library?

Background: I’m having a lot of instability at the moment with my Particle devices losing their cloud connection. My ultimate aim is to ensure publishes are published to the cloud.
Devices are Photons and Cores.

Does anyone know what would be the best way to go about this? I’ve seen there is a library which is Core and Photon compatible which looks like it would help with caching events and sending them when the device is back online again…or there’s the WITH_ACK flag? I confess I’m really confused as to how I would use the WITH_ACK to make my publishing more reliable - does anyone who uses this flag have any examples they wouldn’t mind sharing of how they’re using WITH_ACK ?
I’ve read the thread which looks like an in depth study of how the devices will behave under different conditions, but what I would value are how you would USE the result of the WITH_ACK flag to better work round an unstable network.

Thanks!!

I’ve never used WITH_ACK for publishes, but from reading the docs, WITH_ACK will cause .publish() to block until the cloud confirms the publish event. If this behavior is acceptable for your use case, then WITH_ACK is the simpler to implement.

PublishManager will not confirm your publishes, but it will cache them if your device is offline and send them for you when you’ve made a connection.

WITH_ACK and PublishManager accomplish a similar problem differently. PublishManager is better suited if you’re device is regularly (and intentionally) offline. WITH_ACK is better suited if you’re okay with blocking the thread and you must know the cloud received your publish event.

Two more options:

The PublishQueueAsyncRK also queues publishes when you’re offline, but guarantees the sends don’t block the main loop. This is best if you need to be completely asynchronous and not block the main loop.

The SSE guaranteed delivery example goes one step further: code running on a server acknowledges that the data is received by the server, not just received by the cloud. This also catches any cloud or server issues that could otherwise cause events to be lost.

2 Likes

Thanks - I think this is my situation. My Cores are occasionally knocked offline by Bluetooth interference and I need to make sure messages get delivered.

I must admit I'm still super confused as to how to implement WITH_ACK in my code, and I'm not finding/seeing any examples on the forum of people using it. I'll keep looking.

Did this bug ever get resolved, @rickkas7 ?