pardom
07/17/2019, 3:52 PMwebsocket
routes and http
routes? I get a 500
hitting an http
route when a websocket route is open. I thought it would suspend.gotoOla
07/17/2019, 7:24 PMpardom
07/17/2019, 7:29 PMrouting
block with get
and webSocket
. The get
block response correctly until the webSocket
route is hit, upon which the get
block returns a 500
. I had assumed that each route would suspend, allowing each route to respond concurrently, it appears that they block each other.pardom
07/17/2019, 7:31 PMrouting {
get("/hello") {
call.respond("Hello, World")
}
webSocket("/") { // websocketSession
for (frame in incoming) {
when (frame) {
is Frame.Text -> {
val text = frame.readText()
outgoing.send(Frame.Text("YOU SAID: $text"))
if (text.equals("bye", ignoreCase = true)) {
close(CloseReason(CloseReason.Codes.NORMAL, "Client said BYE"))
}
}
}
}
}
}
gotoOla
07/17/2019, 9:48 PM