https://kotlinlang.org logo
#server
Title
# server
t

tipsy

09/22/2017, 10:46 AM
i just released javalin 0.5.1, which introduces a (imo) very neat websocket api:
Copy code
Javalin.create().apply {
        port(7000)
        ws("/websocket") { ws ->
            ws.onConnect { session -> println("Connected") }
            ws.onMessage { session, message ->
                println("Received: " + message)
                session.remote.sendString("Echo: " + message)
            }
            ws.onClose { session, statusCode, reason -> println("Closed") }
            ws.onError { session, throwable -> println("Errored") }
        }
    }.start()
feedback would be welcome (https://javalin.io/news/2017/09/22/javalin-0.5.1-released.html)