Hey, a question on handling coroutines. Basically,...
# server
h
Hey, a question on handling coroutines. Basically, I want to have websocket a websocket client that connects to some other server. Does it look legit or there are better ways to do it without GlobalScope Not sure what will happen when both websocket and API will try to modify same data but I guess I will find out
Copy code
fun main() {
    GlobalScope.launch {
        val client = HttpClient(CIO) {
            install(WebSockets) {
                pingInterval = 40_000
                            }
        }
        println("sendingxxx")
        client.wss(host = "<http://example.com|example.com>", path = "/socket/websocket") {
        }
    }

    embeddedServer(Netty, port = 8083, host = "0.0.0.0", module = Application::module)
        .start(wait = true)
}

fun Application.module() {
    configureSecurity()
    configureSerialization()
    configureRouting()
}