Skip to content

Instantly share code, notes, and snippets.

@vaibhavgoyal09
Last active November 23, 2021 07:28
Show Gist options
  • Save vaibhavgoyal09/ddb1d34ae4a1f8b19b42b1ca5a33db58 to your computer and use it in GitHub Desktop.
Save vaibhavgoyal09/ddb1d34ae4a1f8b19b42b1ca5a33db58 to your computer and use it in GitHub Desktop.
fun Route.gameSocketRoute() {
route("/v1/game") {
standardWebSocket { socket, clientId, _, payload ->
when (payload) {
is GameMove -> {
socket.send(Frame.Text("Game move received ${payload.position}"))
}
is DisconnectRequest -> {
// Do something here
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment