@nats-io/nats-core
    Preparing search index...

    Type Alias DebugFn

    DebugFn: (
        direction: ">" | "<",
        frame: Uint8Array,
        err?: Error,
    ) => void | undefined

    A debug option function. Called with each frame the client reads (">") or writes ("<"); err is set if the frame failed. A frame is one socket read or write, so it can hold several protocol messages or part of one.

    Using it assumes an understanding of the NATS protocol the client sends and receives. That protocol is not an API: what is sent can change with the client or server version.

    The function gets a copy of the frame, so it can't change what the client sends or processes, but copying every frame costs memory and throughput. debug: true doesn't copy. If the function throws, debug is turned off. Set or remove it on a running connection through options.debug.

    const nc = await connect({
    debug: (direction, frame) => {
    const s = new TextDecoder().decode(frame);
    console.log(direction, s.replace(/"pass":"[^"]*"/, '"pass":"***"'));
    },
    });

    Type Declaration

      • (direction: ">" | "<", frame: Uint8Array, err?: Error): void | undefined
      • Parameters

        • direction: ">" | "<"
        • frame: Uint8Array
        • Optionalerr: Error

        Returns void | undefined