How to handle notification2.0 token expired

Is there any message will be received before the token expired ?

If the token is expired, the websocket client will not get any message, right ?
How can we detect it ?

I cannot confirm that. If the token expires you just cannot establish a WS connection anymore and most probably you get 401. It has no impact on already established WS connections (if I’m not totally wrong).
In my experience the WS connection will not be terminated or notifications just ignored.
If the client is disconnected and token is expired you need to refresh/renew the token.

Yes, as the connection may be terminated at any time for whatever reason you need to be prepared to refresh the token if necessary.

Basically you need two exception handling scopes - if the connection terminates you can just reconnect. If you can’t connect because of a 401 you need to refresh the token before reconnection.

Hi, the token lets you walk through the door, but unless the connection is disconnected, you will continue to receive the notifications. In the event of disconnection, your application would need to get a fresh token. Hope this helps. Thanks

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.