Skip to main content
Question

Understanding parameters in createSubscription()

  • September 9, 2021
  • 3 replies
  • 547 views

I found this in an example of a PubNub subscription. Can someone tell me how the parameters pollInterval and renewHandicapMs are used:

var subscription = subscriptions.createSubscription({ pollInterval: 10 * 1000, renewHandicapMs: 2 * 60 * 1000 });

Also, is it safe to assume that by using the SDK the subscription will be automatically renewed upon expiration? Thanks!

3 replies

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • September 10, 2021

The params are not necessary as they are set default to those values. I don't know why that line is in the getting started sample code. Maybe it was a mistake when we test with different parameters.

This is the correct way to create a subscription using the JS SDK.

const subscriptions = new Subscriptions({
   sdk: sdk
});


The SDK will handle renewal but you need to pay attention to this known issues

https://github.com/ringcentral/ringcentral-js/tree/master/subscriptions#stale-subscriptions


  • Author
  • Known Participant
  • September 10, 2021

  • Author
  • Known Participant
  • September 10, 2021

I took a look at the code and there appears to be a misunderstanding. The code you gave me is not the line I was referring to. I am interested in the last line of this snippet:


var rcsdk = new SDK({ server: RINGCENTRAL_SERVER, clientId: RINGCENTRAL_CLIENTID, clientSecret: RINGCENTRAL_CLIENTSECRET });

var platform = rcsdk.platform();

var subscriptions = new Subscriptions({ sdk: rcsdk });

var subscription = subscriptions.createSubscription({ pollInterval: 10 * 1000, renewHandicapMs: 2 * 60 * 1000 });


On more thing, all of a sudden I am not receiving events via PubNub. I get them with a webhook, but with the PubNub code I can create the subscription, but the on notification callback is never invoked. Up until a few minutes ago this code was working fine. Is there a limit on how much I use PubNub?