Skip to main content

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!

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


Thanks. The funky code is found here: https://developers.ringcentral.com/guide/notifications/push-notifications/quick-start


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?


Reply