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

iOS: Server not responding after getting to background and back. No error event triggered #68

Closed
kelcon opened this issue Jul 9, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@kelcon
Copy link

kelcon commented Jul 9, 2020

Description

Server not responding after getting to background and back
No error event triggered

Steps to reproduce

I have basic server configuration (simple http server). It works perfect while on foreground. If go background, it will stop responding after several seconds. It will not go back nor emit error or close event.

Options:

{
  port: 3032, 
  host: '0.0.0.0',   
  reuseAddress: true,  
}

Current behavior

As described above.

Expected behavior

I assume that error should be triggered as a clou to restart listening.

Screenshots
If applicable, add screenshots to help explain your problem.

Relevant information

OS 13.3
react-native 0.62.2
react-native-tcp-socket 4.2.0
@kelcon kelcon added the bug Something isn't working label Jul 9, 2020
@kelcon kelcon changed the title Server not responding after getting to background and back. No error event triggered iOS: Server not responding after getting to background and back. No error event triggered Jul 9, 2020
@Rapsssito
Copy link
Owner

@kelcon, sorry you have that issue. Sadly, iOS closes all TCP connections after a short period of time after the app has been sent to the background.

However, you can use a background service React Native library to keep your app running in the background with all sockets open. I created react-native-background-actions, but there are a lot of similar libraries.

@kelcon
Copy link
Author

kelcon commented Jul 14, 2020

Thank you. I will check it. I have discovered other approach in the mean time - to listen for an app state change and respawn server after "active" state event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants