push

open override fun push(message: String): Result<Unit>(source)

Deprecated

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

Replace with

import com.spartanlabs.webtools.udp.DeliveryMode
channel(DeliveryMode.UNRELIABLE).send(message)

Sends message as the body of one datagram to peer over the server's shared socket. This is the abstract send primitive; the default push(ByteArray) delegates to it via a UTF-8 decode unless an implementor overrides that overload to send raw bytes.

This is how a subclass sends to one specific client over the shared channel - key connections by name or peer and call push on the one you want; MultiConnectionUDPServer.pushToAll is the broadcast-to-everyone path, not the only per-client path.

Return

Result.success if the message was sent, or the failure that prevented it

Parameters

message

the text to send


open override fun push(bytes: ByteArray): Result<Unit>(source)

Deprecated

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

Replace with

import com.spartanlabs.webtools.udp.DeliveryMode
channel(DeliveryMode.UNRELIABLE).send(bytes)

Frames bytes as an 0x90 unreliable datagram ([0x90][channel][payload]) and sends it to peer. Any payload bytes are delivered to the peer intact - there is no reserved first byte.