The session handler is set up before opening the connection as instructed in the documentation.
The scenario that I want to handle is when a session token is expired or revoked, so I could request for a new session token and call onSuccess in the onSessionTokenRequired handler.
Currently none of the events are triggered when I revoke the token, or when I purposely issue a short-lived token and wait for it to expire.
What I noticed is, both these scenarios (revoked or expired token) triggers the onReconnectStarted event instead, but that’s not what I need, as it will only keep on retrying to connect which fails because the token is no longer valid.
I actually discovered this a few days ago and am currently working with our Engineering team to resolve this in the Javascript SDK.I will update here once they have been resolved.
We’ve completed the work internally and are just waiting for it to be released. I’ll post here when the version that includes the fix has been released. I apologize for the delay!
Hi @hewong Good news, this was released in version 3.1.10 which was released today. Please give it a try and let me know if you’re running into any issues.
Hi @Tyler , I’ve upgraded to v3.1.10 and tried the session handlers again.
From what I understood from the documentation (correct me if i’m wrong), onSessionTokenRequired should be triggered when a session token expires during a session, so I could request a new session token and pass it into the onSuccess callback to refresh the session.
This is what I did:
set up session handlers
connect to sendbird with a valid session token
wait for session token to expire
I expect onSessionTokenRequired to be triggered when the token expires, but onSessionError was triggered instead.
Did I understand the handlers correctly or did I miss anything here?
Hi @Tyler , I am on sdk version 4.0.3 and still experiencing the same issue. Please check the following snippet. The onSessionRequired never gets called when a session expires.