Companion

object Companion

Functions

Link copied to clipboard

Parse ONE already-deframed message body: the 4-byte length prefix has been stripped, so frame is [id][payload...] (length >= 1 for a real message). An empty frame is a keep-alive (the caller saw length == 0).

Link copied to clipboard
fun tryReadMessage(buffer: ByteArray, offset: Int = 0): Pair<PeerMessage, Int>?

Stream-framing read. Treats buffer[offset until buffer.size] as a byte stream and tries to pull exactly one length-prefixed message off the front.