Documentation
    Preparing search index...

    Interface LoopbackSocket

    One in-memory loopback connection. Every send is echoed back and can be drained with receive.

    const opened = createMockLoopbackNetwork(['wss://events.example.org']).open('wss://events.example.org/feed');
    if (opened.ok) { opened.socket.send('ping'); opened.socket.receive() === 'ping'; }
    interface LoopbackSocket {
        isOpen: boolean;
        sent: readonly string[];
        url: string;
        close(): void;
        receive(): string | undefined;
        send(data: string): boolean;
    }
    Index

    Properties

    Methods

    Properties

    isOpen: boolean

    Whether the socket is still open.

    sent: readonly string[]

    Everything sent so far.

    url: string

    Target URL as opened.

    Methods