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

    Simulates a WebSocket connection for a local ZMQ kernel. Routes kernel protocol messages between the webview and the LocalKernelClient. Supports multiple WebSocket connections to the same kernel.

    Index

    Constructors

    Properties

    _clientIds: Set<string> = ...

    Set of all active WebSocket connection IDs for this kernel

    _kernel: IKernelConnection

    The underlying JupyterLab kernel connection

    _kernelClient: LocalKernelClient

    The local kernel client managing the kernel lifecycle

    _kernelSessionId: string = null

    The kernel's actual session ID

    _messageHandlers: Map<string, (msg: IMessage) => void> = ...

    Map of message handlers for routing kernel messages

    _rawSocket: unknown

    RawSocket from the kernel connection for direct ZMQ communication

    _sessionIdMap: Map<string, string> = ...

    Maps request message IDs to JupyterLab's session IDs. Required because the kernel uses its own session ID, but JupyterLab expects replies to use the same session ID as the request.

    _webview: WebviewPanel

    The webview panel to send messages to

    Methods

    • Forwards a kernel message to the webview as a WebSocket message. Sanitizes Buffer objects in the idents field to proper format for postMessage. Also translates the kernel's session ID to JupyterLab's expected session ID.

      Parameters

      • msg: IMessage

      Returns void

    • Sends a message to the webview. Broadcasts to all registered client connections, or to a specific client if specified.

      Parameters

      • type: string
      • body: unknown
      • OptionalspecificClientId: string

      Returns void

    • Sets up listeners for kernel messages and forwards them to the webview. Connects to the kernel's IOPub and status change signals.

      Returns void

    • Registers an additional WebSocket connection to this kernel.

      Parameters

      • clientId: string

        The WebSocket connection ID to register

      Returns Record<string, never>

      An empty object for the websocket-open message body

    • Handles incoming WebSocket messages from the webview. Translates them to kernel protocol operations.

      CRITICAL: Intercepts kernel_info_request and responds immediately with a proper reply. This allows JupyterLab's kernel.ready Promise to resolve correctly.

      Parameters

      • data: unknown

      Returns void

    • Removes a WebSocket connection from this kernel.

      Parameters

      • clientId: string

        The WebSocket connection ID to remove

      Returns boolean

      True if there are still active connections, false if this was the last one