I'm looking at using URL parameters in Ktor websoc...
# ktor
m
I'm looking at using URL parameters in Ktor websockets:
Copy code
webSocket("/ws/{documentId}") {
            val session = call.sessionOrNull<Session>()
            if(session == null) {
                close(CloseReason(CloseReason.Codes.VIOLATED_POLICY, "No Session"))
                return@webSocket
            }

            var topic: String = if (call.parameters["documentId"] != null) call.parameters["documentId"].toString() else ""
            if (topic.isEmpty()) {
                throw IllegalArgumentException("Empty topic")
            }