crossbario / autobahn-java

WebSocket & WAMP in Java for Android and Java 8
https://crossbar.io/autobahn
MIT License
1.52k stars 427 forks source link

Fix exception when closing reader on main thread #542

Closed novak-dev closed 1 year ago

novak-dev commented 1 year ago

Using similar approach to https://github.com/crossbario/autobahn-java/pull/271

oberstet commented 1 year ago

there is no bug report or issue for the changes in this PR.


also: both are likely wrong ... the socket must be closed not on the main thread, but by sending the network background thread using the socket a message and let that background thread close the socket

spawning a new thread to work around closing the socket from the UI thread is a hack

also: using a socket (doing networking) on the UI thread is not allowed. but closing a socket? that's also not allowed on UI thread? what's the exception?

novak-dev commented 1 year ago

@oberstet I agree its a hack, proper solution would be to handle close message in a different thread from the UI thread on android. I will create an issue.