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

WSManager does not reconnect after connectivity change. #11

Open
rahatshahzeb opened this issue Mar 26, 2019 · 1 comment
Open

WSManager does not reconnect after connectivity change. #11

rahatshahzeb opened this issue Mar 26, 2019 · 1 comment

Comments

@rahatshahzeb
Copy link

No description provided.

@Dodger92
Copy link

Dodger92 commented Sep 14, 2020

I solved this issue by tracking connection changes using the ConnectivityManager and manually reconnecting the socket

val networkCallback: ConnectivityManager.NetworkCallback =
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                object : ConnectivityManager.NetworkCallback() {
                    override fun onAvailable(network: Network) {
                          wsManager?.startConnect()
                    }
                    override fun onLost(network: Network) {
                        wsManager?.stopConnect()
                    }
                }
            } 

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

2 participants