When pubnub is connected, users inside my app receive messages no problem. However, let's say they refresh the page or go to another page within the app. There's a 2 -> 5 seconds of downtime before the user can connect to pubnub again. During this time some pubnub messages may be missed.
Thankfully, the pubnub subscribe API allows you to specify a timetoken
to point to a past time (e.g. 10 seconds ago).
pubnub.subscribe({
channels: ['my_channel'],
timetoken: '13534398158620385'
});
Description:
Specifies timetoken from which to start returning any available cached messages.
Question:
What's the safest way to specify this timetoken
such that few messages are missed?