Networking · function
decode
Read a message's header into out. false when the bytes are not a message this version knows.
Explained in Networking and rollback.
function decode(message: Uint8Array, out: DecodedMessage): booleanimport { decode } from '@driftengine/network';Parameters
| Parameter | Type | Description |
|---|---|---|
message | Uint8Array | |
out | DecodedMessage |
In depth
A payload is located rather than copied. payloadAt and payloadBytes point into the buffer
the caller was handed, which the transport may reuse the moment the sink returns — the same
borrow MessageSink documents. A caller keeping a payload copies it, and one feeding it straight
to RewindLoop.supply does not need to.