Skip to main content

We are using the C# SDK to collect real-time data events. We have observed a few issues.

  1. The documentation indicates the tokens are supposed to auto-refresh. We are capturing the token refresh events and observe that they seem to automatically refresh twice (a little less than an hour apart), but usually within 3 hours we no longer receive data events. We also tried manually renewing the subscription, but it that did not seem to have any effect on the data.
  2. To address issue 1 above we began monitoring when the subscription was set to expire and if that time lapsed, re-create the connection. This approach seemed to work but we noticed that call events become delayed. Initially only by a minute but as time goes on we have seen delays of over 10 minutes.

Hi Drew,

First of all, I recommend you to use the latest .Net SDK instead of the old C# SDK. The new SDK is much more stable and up-to-date. It does not support auto-refresh token though, but we see that feature is not ideal for real production apps. Especially when the token needs to be shared between processes/apps. We let developers control and manage the refresh token process the way they want to. In the future, we may add it back but the default behavior will be not auto-refreshed.

Back to your problem, it is hard to tell what could be the root cause because there are many components involved in the notification chain. The delay could be because of our system or could be somewhere in the chain thru PubNub too.

If you expect your system to run for long hours or days, I recommend to use Webhook notifications instead of PubNub.

If you still want to tackle the current problem with option "2", can you change your implementation in the way that you don't wait until the subscription expires but a minute before that moment, you cancel the notification then re-create a new one. Also always check if there are multiple active subscriptions due to old subscription has not been completed shut down etc.


Reply