orangy
tipsy
01/05/2018, 7:07 PMtipsy
01/05/2018, 7:08 PMorangy
leus
01/08/2018, 7:21 PMleus
01/08/2018, 7:22 PMorangy
val messages = ConflatedBroadcastChannel<String>() // local message bus
// where you've got message
messages.offer(message) // send a string to channel's subscribers
// inside your routing
webSocket("ws") {
messages.openSubscription().use { subscription -> // subscribe to channel
subscription.consumeEach { // on each message
outgoing.send(Frame.Text(it))) // send message as text frame to any connected websocket client
}
}
}
orangy
install(WebSockets)
in your appleus
01/08/2018, 9:05 PM