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

Server is not alive after iOS device is 'locked' #39

Closed
DanielHudson opened this issue Mar 18, 2018 · 3 comments
Closed

Server is not alive after iOS device is 'locked' #39

DanielHudson opened this issue Mar 18, 2018 · 3 comments

Comments

@DanielHudson
Copy link

DanielHudson commented Mar 18, 2018

keepAlive works fine when the app is in the background, however when the device is locked or goes into standby the server is no longer running in the background, or when the app is put into the foreground again.

Not sure if keepAlive is meant to support this or not, I am considering starting the server again manually once the app is 'active' as a work around for now.

@tomjohnson3
Copy link

@DanielHudson - i'm having the same issue. could you share a pull request? or perhaps we could collaborate on this? i was thinking of the same type of work-around.

@DanielHudson
Copy link
Author

DanielHudson commented Mar 19, 2018

Starting the server again when the app becomes active via AppState works well for me.

I had to ditch the random port selection since I don't want to update or refresh my webview when the application becomes active again. I guess I could code around this by storing the port number, but for now it's working for me.

Unfortunately I'm not familiar with Android enough to make a pull request, I'm also not sure if this is an issue with this package, or the GCDWebServer. (It might not even be an issue!)

@fchasen
Copy link
Contributor

fchasen commented Mar 20, 2018

I not sure we there is a way to keep the server going when the phone is locked.
I'd recommend using AppState.addEventListener('change') and just starting the server again.

@fchasen fchasen closed this as completed Mar 20, 2018
zatteo added a commit to cozy/cozy-flagship-app that referenced this issue Sep 1, 2023
…bview loading

On Android, when we ask for notification permission, app goes to background. This was causing HttpServer to stop (which is an intented behavior futurepress/react-native-static-server#39), but it was stopped during Home webview loading leading to a blank screen.

So now, we ask for notification permission before loading a webview.
zatteo added a commit to cozy/cozy-flagship-app that referenced this issue Sep 1, 2023
…bview loading

On Android, when we ask for notification permission, app goes to background. This was causing HttpServer to stop (which is an intented behavior futurepress/react-native-static-server#39), but it was stopped during Home webview loading leading to a blank screen.

So now, we ask for notification permission before loading a webview.
smellman pushed a commit to smellman/react-native-static-server that referenced this issue Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants