Research API user guide 2.0, page 17 says:
"Note: Cloud credentials are active for one hour; please refresh the credentials five minutes before the expiration."
Is there any sample code available for the process?
If “Atexit.register(removeSubscription)” is deleted from “startResearchAlerts() sample, currentSubscriptionID returned by “subscribeToResearch” is always the same? In other words, is it not necessary to change the below part to get current subscription ID? If yes, please advise how to change.
Your application will have to store the subscription parameters from existing subscription and skip the SubscribeToResearch() function. Calling this function again, will create a new subscription for the application - which is not what you want. At some point new subscriptions will be denied as well.
To refresh cloud credential, application just sends a new cloud credential request. The request is exactly the same as the initial cloud credential request. For 5 minutes before expired, you can use a timer with 55 minutes expired to call the cloud credential request.
Is it essentially no difference between sending a new credential request before 5 min expiration and sending it after expiration as far as using the same subscription?
See the python Research Messages sample provided in the downloads tab. It does not proactively try to refresh the Cloud credentials, but does so upon expiry-exception.