startBytes

fun startBytes(onClientMessage: (ByteArray) -> Unit): Result<Unit>(source)

Binds onClientMessage as the raw-bytes handler on every currently-registered connection: each receives an exact-length, undecoded, untrimmed copy of every application datagram (at most 65507 bytes - a larger inbound datagram is truncated, not rejected). Mutually exclusive with start per connection (last call wins). No socket is started - the one shared socket is already running.

Return

Result.success if every connection was actuated, or the first failure

Parameters

onClientMessage

callback invoked with the raw datagram body; it runs on the single-threaded dispatch executor, not the caller's thread, so it must return quickly