qbit-rpc
    Preparing search index...

    Interface ZmqSocket

    The part of a ZeroMQ SUB socket the subscriber uses. zeromq's Subscriber satisfies it.

    interface ZmqSocket {
        events?: {
            on(
                type: "disconnect" | "close" | "handshake",
                listener: () => void,
            ): unknown;
        };
        close(): void;
        connect(url: string): void;
        receive(): Promise<readonly Uint8Array<ArrayBufferLike>[]>;
        subscribe(topic: string): void;
    }
    Index
    events?: {
        on(
            type: "disconnect" | "close" | "handshake",
            listener: () => void,
        ): unknown;
    }

    Socket events (zeromq's observer). When present, the subscriber replaces the socket on a disconnect (the connection dropped) or a close (a connection attempt failed), and when no handshake (a connection is ready) has come within its handshake deadline of connect(): a createZeromqSocket socket does not reconnect by itself, and messages published meanwhile are lost anyway. A custom socket with events emits all three, as zeromq's does; for one that never emits handshake, the first message counts as one.

    Type Declaration

    • on: function
      • Call listener on each event of type.

        Parameters

        • type: "disconnect" | "close" | "handshake"
        • listener: () => void

        Returns unknown

    • The next message's frames.

      Returns Promise<readonly Uint8Array<ArrayBufferLike>[]>

    • Subscribe to the messages whose topic starts with topic.

      Parameters

      • topic: string

      Returns void