Datalayer VS Code Extension - v0.0.17
    Preparing search index...

    Raw ZMQ socket that wraps kernel channels in WebSocket-like interface. Used by @jupyterlab/services for kernel communication.

    Index

    Constructors

    • Creates a new RawSocket instance that wraps ZMQ channels in a WebSocket-like interface. Initializes kernel communication channels (shell, control, stdin, iopub).

      Parameters

      • connection: IKernelConnection

        Kernel connection configuration from the connection file.

      • serialize: (msg: IMessage) => string | ArrayBuffer

        Function to serialize kernel messages to string or ArrayBuffer format.

      Returns RawSocket

    Properties

    onclose: (
        event: {
            code: number;
            reason: string;
            target: unknown;
            wasClean: boolean;
        },
    ) => void = noop

    Callback invoked when the socket connection closes. Signature: (event: { wasClean: boolean; code: number; reason: string; target: unknown }) => void.

    onerror: (
        event: {
            error: unknown;
            message: string;
            target: unknown;
            type: string;
        },
    ) => void = noop

    Callback invoked when a socket error occurs. Signature: (event: { error: unknown; message: string; type: string; target: unknown }) => void.

    onmessage: (event: { data: Data; target: unknown; type: string }) => void = noop

    Callback invoked when a message is received from the kernel. Signature: (event: { data: WebSocketWS.Data; type: string; target: unknown }) => void.

    onopen: (event: { target: unknown }) => void = noop

    Callback invoked when the socket connection opens. Signature: (event: { target: unknown }) => void.

    protocol: ""

    WebSocket protocol version string. Empty for raw ZMQ sockets, matches WebSocket interface.

    Methods

    • Register a hook to intercept incoming kernel messages.

      Parameters

      • hook: (data: Data) => Promise<void>

        Async function called with serialized message data.

      Returns void

    • Register a hook to intercept outgoing kernel messages.

      Parameters

      • hook: (data: unknown, cb?: (err?: Error) => void) => Promise<void>

        Async function called before message is sent.

      Returns void

    • Emit an event by invoking the corresponding callback handler.

      Parameters

      • event: string | symbol

        Event name (message, close, error, or open).

      • ...args: unknown[]

        Event arguments passed to the handler.

      Returns boolean

      Always true.

    • Remove a previously registered receive hook.

      Parameters

      • hook: (data: Data) => Promise<void>

        Hook function to remove from the receive chain.

      Returns void

    • Remove a previously registered send hook.

      Parameters

      • hook: (data: unknown, cb?: (err?: Error) => void) => Promise<void>

        Hook function to remove from the send chain.

      Returns void

    • Send a kernel message through the appropriate ZMQ channel.

      Parameters

      • data: unknown

        Kernel message to send.

      • _callback: unknown

        Unused callback parameter for WebSocket API compatibility.

      Returns void