actuate

abstract fun actuate(onMessage: (message: String) -> Unit): Result<Unit>(source)

Deprecated

Use channel(DeliveryMode.UNRELIABLE).actuate(...) - see the 2.0 channel API

Replace with

import com.spartanlabs.webtools.udp.DeliveryMode
channel(DeliveryMode.UNRELIABLE).actuate(onMessage)

Registers onMessage as the handler for datagrams from this client. No socket is bound - the server already owns the one shared socket; this only routes inbound datagrams whose source matches peer to onMessage. Calling this on a connection that has been terminated is a silent no-op (see terminate). The handler receives the trimmed UTF-8 text of each datagram; for a binary protocol use actuateBytes instead.

Return

Result.success once the handler is registered, or the failure that prevented it

Parameters

onMessage

callback invoked with the decoded text of each message received; it runs on the server's single-threaded dispatch executor, not the caller's thread, so it must return promptly - a slow handler delays delivery to other clients