News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Understanding parameters in createSubscription()
Tags: pubnub
Sep 9, 2021 at 2:24pm   •   3 replies  •  0 likes
Andrew Prokop

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 Answers
answered on Sep 10, 2021 at 8:25am  

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


 0
answered on Sep 10, 2021 at 7:17am  

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


 0
answered on Sep 10, 2021 at 8:47am  

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?


 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us