onMessage

fun onMessage(block: suspend SocketSession.(String) -> Unit): SocketBuilder

Sets the callback to be invoked when a message is received through the WebSocket connection.

Return

The SocketBuilder instance for chaining.

Parameters

block

A suspend function that will be called when a message is received.