Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If an application is opened for a long time, aka in a long life browser's tab and you never close the browser and that the client can go on a sleep or else, WS can not be connected.
So we try 2 things here:
First is to reconnect after a refreshedToken. It can be useful because CozyClient will try to refresh the token after 24h. So if the token is refreshed, it means that the client has an internet connexion and just make a request so it's the right time to reconnect with this new token
Second is to play with the visibility API. Before, the reconnexion was not very aggressive. We only tried if we were in a process to trying to reconnect by accelerating the reconnexion process. Now we try to reconnect also if the current websocket is closed.