Connection issues / Disappearing Composer component
We spotted that sometimes the Composer component disappears and new messages are not delivered. We cannot find exact time when it's happening as it happened only a few times. It looks like some connection issue but I don't know how to confirm it. Initially I thought it's connected with hot module reloading but it also happened on the staging environment as well.
Currently we have <CordProvider> component mounted pretty high in components tree that is fetching the clientAuthToken from backend when app is bootstrapped. Should we somehow take care of refreshing this token periodically?
From what I saw the token generated on the backend is valid only for one minute so I guess you must be doing some refreshes in the background.
Hi @Damian Pasek, without some more details it would be tough for us to give you a totally confident answer. That said, if you're hanging onto the clientAuthToken for more than 1 minute, that could be the issue. A Cord clientAuthToken is meant to be very short-lived. You fetch it from your backend, use it with the CordProvider and the WebSocket connection will be established. The clientAuthToken is meant to be valid only long enough for that process to take place. If you're caching it locally, for instance, it's likely expired by the time you refresh the page or hot reload the packages.
Let us know if that helps!
We added logger to onInitError callback + refetching token from backend in case of errors. We indeed use react-query for fetching and it's caching the value but I wasn't able to reproduce this error with cached value.
We are gonna monitor it now and see if it will occur again, it happened only a few times so it's hard to reproduce.