I have a little problem with <https://github.com/T...
# coroutines
j
I have a little problem with https://github.com/TooTallNate/Java-WebSocket and Kotlin Coroutines (Client). If I disconnect, I want to reconnect again. I can't just do that in <MyClient>.onClose because that's on the websocket thread. I want to fix that with coroutines but just <Scope>.launch { reconnect() } doesn't work because the program closes (probably non-blocking). Any ideas?
t
Copy code
runBlocking {     <Scope>.launch(<http://Dispatchers.IO|Dispatchers.IO>) {  reconnect() } 
}
scope.launch return immediately, since onClose is not a suspend function you have to use runBlocking