Determine Jira cloud session Timeout

We are showing our gadget inside the Jira page and the gadget can be set to periodically refresh its own contents. While refreshing it can be set to renew its own session so it never expires while the page is open. I’m wondering can I determine somehow if the Jira session is not timeouted without refreshing it? By default, the Jira session is 30 days after the last user activity. ( The activity can be passive - page own/API action. I see that the Jira Cloud page periodically is calling API “/gateway/api/notification-log/api/2/notifications/count/unseen”. Does this call refresh Jira’s session timeout counter? If I check session availability with AP.context.getToken - does this call refresh session timeout? (

I am not sure is this good solution but think you need to programmatically implementing JavaScript Job that makes API calls every 5 seconds and reports to the user token is expired and gives “pop-up” with message that tells to user token is expired and button to refresh your App. But I think this is usable only with iframe Apps. Anyone else haves suggest to solution for this issue?