Queue publishes calls from PubNub offline

I am in the process of using PubNub for different parts of my application. I am using their AngularJS library for this.

Right now I'm just testing it for "analytics". Basically, I want to track when the user adds app buttons, navigation buttons, etc. So, I track the activity and post to the channel.

Everything works fine - when the user is online. However, offline I lose all this tracking. I was kind of hoping that the PubNub client would automatically stop all publish requests. It doesn't look like this.

So, I think I will have a service to collect all the publish requests and queue them up if the device is offline. When the device is back online, I will post any queued requests.

Is this the best approach? Does anyone have a better suggestion? PubNub already has this ability and I just can't find it?

+3


source to share


1 answer


Yes, this is currently the best way to do it.

There are different scenarios for queuing / retrying, for example - depending on the content of the message (for example, the expiration / timeliness of the message), and depending on the reason (no internet, channel permissions) you might want to re -queue / retry some rather than others, etc.



So, if you can implement your own replay logic in your use case, this is ideal. We can provide more productive options in this move forward ...

Geremy

+1


source







All Articles