Networking · type
MessageSink
Where a drained message goes.
Explained in Networking and rollback.
type MessageSink = (from: PeerId, message: Uint8Array) => voidimport type { MessageSink } from '@driftengine/network';In depth
The bytes are borrowed, not given: the array is the transport's and may be reused as soon as
this returns. A sink that needs to keep one copies it. That is the same contract MessageQueue
and the render passes use, and it is what keeps a drain allocation-free.