birdofpreyru / react-native-static-server

Embedded HTTP server for React Native
https://dr.pogodin.studio/docs/react-native-static-server
Other
135 stars 21 forks source link

Server died in sleep mode #104

Closed triracle97 closed 4 months ago

triracle97 commented 4 months ago

On iOS, whenever I turn off screen of my device, I can’t connect to the server anymore, even getActiveServerId return non null value

How to reproduce (I’m using rn 0.72)

I expect the server keeps running or should restart or throws a state change but it doesn’t

birdofpreyru commented 4 months ago

Hey @triracle97 , I never tried to run it in the background, and early on I got an impression it might not work across staying in the background, if not restarted after returning into the foreground, thus so far I always use stopInBackground option in my apps myself.

My first guess is, it probably needs correct background execution modes configured to be able to stay alive in / across the phone falling asleep. Do you have that configured for your app?

triracle97 commented 4 months ago

Thank you! Running in foreground is enough for me, can close the issue here.