Networking · interface

Transport

Explained in Networking and rollback.

interface Transport
import type { Transport } from '@driftengine/network';

Properties

NameTypeDescription
statereadonlyTransportState
selfreadonlyPeerIdThis end's own id, or -1 before a host has assigned one.

Methods

send

send(to: PeerId, message: Uint8Array): void

Queue a message. Whether it arrives, in order, or at all is the implementation's business.

ParameterTypeDescription
toPeerId
messageUint8Array

drain

drain(into: MessageSink): void

Hand every message that has arrived to the sink, oldest first, and clear them.

ParameterTypeDescription
intoMessageSink

close

close(): void