Hi all, it looks like you can’t cash `HttpClient` ...
# ktor
b
Hi all, it looks like you can’t cash
HttpClient
with
CIO
when using
WebSockets
. But it looks working fine with Http ? Here is the error i am getting Kotlin multiplatform: JobCancellationException: Parent job is Completed
a
Could you please share a code snippet to reproduce your problem?
b
Copy code
class MyService {
    private val client= HttpClient {
       install(WebSockets)
    }
    fun openSocket() {}
    fun closeSocket(code: Int, reason: String) {}
    fun sendMessage(msg:String) {}
}
The issue was when using the same instance of
MyService
Copy code
val myService = MyService()
myService.sendMessage();
Here i want to reuse the same
myService
instead of creating a new instance each time i want to start a new connection