RemoteFraming

class RemoteFraming(limits: RemoteLimits = RemoteLimits()) : AutoCloseable(source)

Ordered bounded framing for one player connection. Only one partially received logical message is retained; interleaving or replay is rejected. A zero-length cancellation frame retires that transfer without delivering partial application data. The owner supplies monotonic milliseconds and closes this object on disconnect or protocol failure.

Constructors

Link copied to clipboard
constructor(limits: RemoteLimits = RemoteLimits())

Functions

Link copied to clipboard
open override fun close()

Releases partially assembled bytes and prevents subsequent use.

Link copied to clipboard
fun expire(nowMillis: Long)

Checks an incomplete transfer even when the peer stops sending bytes.

Link copied to clipboard
fun receive(bytes: ByteArray, nowMillis: Long): ByteArray?

Returns a completed owned message, or null while receiving its remaining fragments. Any invalid fragment releases partial data before its failure escapes.

Link copied to clipboard
fun send(bytes: ByteArray, send: (ByteArray) -> Unit)

Delivers consecutive fragments synchronously; the caller must not interleave another message.