Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning about timers on React Native #164

Open
alexsegura opened this issue Sep 2, 2021 · 5 comments
Open

Warning about timers on React Native #164

alexsegura opened this issue Sep 2, 2021 · 5 comments

Comments

@alexsegura
Copy link

Related to facebook/react-native#12981

Capture d’écran 2021-09-02 à 14 44 40

@FZambia
Copy link
Member

FZambia commented Sep 2, 2021

@alexsegura hello, could you explain what should be addressed here by centrifuge-js?

@alexsegura
Copy link
Author

alexsegura commented Sep 2, 2021

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?

@alexsegura
Copy link
Author

I think it's there no?

_getTTLMilliseconds(ttl) {
// https://stackoverflow.com/questions/12633405/what-is-the-maximum-delay-for-setinterval
return Math.min(ttl * 1000, 2147483647);
}

@FZambia
Copy link
Member

FZambia commented Sep 2, 2021

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?

@FZambia
Copy link
Member

FZambia commented Sep 2, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants