ExperimentalExperimentalonCalled when the transport connection closes
ExperimentalonCalled when an error occurs
ExperimentalonCalled when a message is received. Data is either a string (JSON) or Blob (binary).
ExperimentalonCalled when the transport connection opens
Readonly ExperimentalurlThe URL this transport is connected to, if applicable
ExperimentalSend data (string for JSON messages, Uint8Array for binary)
ExperimentalStart the connection. Called by NetworkConnection after event callbacks are set. May return a promise if setup is async (e.g. dynamic imports).
Interface for a network transport layer used by NetworkConnection. The default implementation wraps a websocket via
websocket-ts. Custom implementations can be injected into NetworkConnection.connect for testing or alternative transports.Lifecycle: After creating a transport and passing it to
connect(),NetworkConnectionsets the four event callbacks (onOpen,onClose,onError,onMessage) and then calls start. The transport should callonOpenwhen the connection is ready.