-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
NetworkOnMainThreadException during disconnect() #21
Comments
jhansche
changed the title
NetworkOnMainThreadException during close()
Mar 23, 2017
NetworkOnMainThreadException
during close()
jhansche
changed the title
NetworkOnMainThreadException during close()
NetworkOnMainThreadException during disconnect()
Mar 23, 2017
One more reason I'd use the OkHttp version. It handles its own threading. https://medium.com/square-corner-blog/web-sockets-now-shipping-in-okhttp-3-5-463a9eec82d1 |
Fair enough. But if that's going to be a longer discussion or longer implementation time, I'm just going to work on fixing it in TubeSock for now. |
jhansche
pushed a commit
to wondrous-io/ParseLiveQuery-Android
that referenced
this issue
Mar 23, 2017
…utor TubeSock already uses a background thread for `open()`, but it keeps the `close()` call on the calling thread. So `open()` is safe on the main thread, but `close()` is not.
jhansche
pushed a commit
to wondrous-io/ParseLiveQuery-Android
that referenced
this issue
Mar 23, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The act of disconnecting the client attempts to perform a network request on the main thread, leading to a crash:
All other network-related tasks are done in a background TaskExecutor. But
disconnect()
, which callsWebSocket.close()
, is not happening on that background thread.The text was updated successfully, but these errors were encountered: