centrifuge-js
centrifuge-js copied to clipboard
Warning about timers on React Native
Related to facebook/react-native#12981

@alexsegura hello, could you explain what should be addressed here by centrifuge-js
?
Hi @FZambia sorry for the poorly detailed issue 😔
I haven't read centrifuge-js
code, but I guess the JavaScript runtime could be detected, and the (default) timeout value could be set accordingly?
I think it's there no?
https://github.com/centrifugal/centrifuge-js/blob/7b70bf21007ae39e79069e9e938c0d5aa1b97718/src/centrifuge.js#L1208-L1211
I haven't read centrifuge-js code, but I guess the JavaScript runtime could be detected, and the (default) timeout value could be set accordingly?
What do you mean by setting default
timeout?
Looking at screenshot you provided your tokens expire In one hour. In this case centrifuge-js sets timer for one hour to refresh token after that. Do you have any specific fix for React Native warning in mind?
Also, did you experience any problems with client behavior?
In general, as your application goes to background you should not keep connection active. This is a common thing on mobile devices since they do not guarantee connection stability while app in background. So token refresh timer should be cleaned up upon disconnecting and going to background.
I never worked with React Native personally though, correct me if I am missing sth.