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
Subscription renewal Explain
Tags: rest api
Nov 20, 2019 at 7:28am   •   4 replies  •  0 likes
Muhammad Shoaib

I'm bit confused about subscription renewal, I've successfully followed the tutorial for presence events and I now get notified, but after I went through this tutorial https://ringcentral-tutorials.github.io/subscription-basics-nodejs-demo/ I'm confused about subscription renewals do they get handled internally or do we need to use an API after every x interval to renew the subscription to make sure we keep getting the notifications?

4 Answers
answered on Nov 21, 2019 at 5:48am  

@Phong Vu by disconnection I meant if the app logouts for some reason (internet connectivity issue). but I guess we can just check using the loggedin() and call login() if true. Also can you kindly shed some light on as to why webhooks are preferred over pubnub for app that's meant to run for weeks or months continuously.


 0
answered on Nov 20, 2019 at 3:16pm  

That tutorial does not discuss about renew a subscription. The reason I added 2 additional functions to check existing subscription and remove the subscription was explained in the tutorial (don't want to have many pending subscriptions while rerun app too often to test).

Basically, the SDK support PubNub notification and it expires after 15 minutes. That's why the SDK was implemented to refresh the notification more frequently.

You said "disconnection from RingCentral server", do you mean the app/user logout or terminate the app? Anyway, you can call the platform.logout() to log out deliberately.

If you want to check if your app is still logged in (meaning the access token is still valid) you can call platform.loggedIn() which returns true or false accordingly. If it returns false, then call platform.login() to login again. If it is true, you are good to call any APIs.

If you app suppose to run for weeks or months continuously, I recommend to use Webhooks notifications instead of PubNub notification. Check this quick start to learn more about RingCentral Webhooks.


 0
answered on Nov 20, 2019 at 1:44pm  

First of all, the SDK renews the subscription automatically as long as the access token is still valid. You should implement the callback functions to decide what to do:

// Register Platform Event Listeners
platform.on(platform.events.refreshSuccess, handleRefreshSuccess);
platform.on(platform.events.refreshError, handleRefreshError);
// Register Subscription Event Listeners
subscription.on(subscription.events.renewSuccess, handleSubscriptionRenewSuccess);
subscription.on(subscription.events.renewError, handleSubscriptionRenewError);

What is the tutorial for presence do you refer to?


 0
answered on Nov 20, 2019 at 2:14pm  

@Phong Vu sorry for omitting the info, this is the presence tutorial I was referring to https://ringcentral-tutorials.github.io/callrecording-notification-node/?distinctId=16e69c9b43c9e-0f45863320bf05-1d3d6b55-13c680-16e69c9b43dc9b, also I couldn't find anything related to handling the disconnection from ringcentral server, more precisely how can we handle the disconnect if we are disconnected from this

var platform = rcsdk.platform();
        platform.login({
            username:un,
            password:pwd
        }).then()

what I am looking for is to reconnect after we get disconnected and then do we need to re-do the subscription process?


 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