Viktorani API - v0.0.8
    Preparing search index...

    Interface ITransport

    All transports are one-room-per-instance. Call connect() once per session; call disconnect() before switching rooms or transport modes.

    interface ITransport {
        status: TransportStatus;
        transportType: TransportType;
        connect(config: TransportConfig): Promise<void>;
        disconnect(): void;
        onEvent(handler: (event: TransportEvent) => void): () => void;
        send(event: TransportEvent): void;
    }

    Implemented by

    Index

    Properties

    Current connection lifecycle state.

    transportType: TransportType

    Which concrete transport is active.

    Methods

    • Establish a connection to (or create) the specified room.

      Parameters

      Returns Promise<void>

      Resolves when the connection is ready to send and receive events.

    • Subscribe to incoming events.

      Parameters

      • handler: (event: TransportEvent) => void

        Called for every event received.

      Returns () => void

      An unsubscribe function — call it to stop receiving events.