question

Drew Walker avatar image
Drew Walker asked Phong Vu answered

C# SDK - Subscription Service - Stops receiving real-time events

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.
subscriptionsc#sdk
1 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

·
Phong Vu avatar image
Phong Vu answered

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.

1 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.