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

    WebSocket adapter that runs in the extension (Node.js context). Manages WebSocket connection to Loro collaboration server.

    Index

    Constructors

    Methods

    • Connect to the WebSocket server. Establishes a new WebSocket connection if one doesn't already exist. Sets up event handlers for open, message, close, and error events. Messages received while disconnected are queued and sent upon reconnection. Automatically attempts to reconnect with exponential backoff on close.

      Returns void

      Void.

    • Disconnect from the WebSocket server. Cancels any pending reconnection timers and closes the WebSocket connection. Safe to call multiple times; handles null checks internally.

      Returns void

      Void.

    • Clean up resources and prepare for garbage collection. Marks the adapter as disposed, disconnects from the server, and clears the message queue. After disposal, the adapter should not be used.

      Returns void

      Void.

    • Check if the WebSocket is currently connected and ready to send. Verifies that the WebSocket exists and readyState is 1 (OPEN).

      Returns boolean

      True if connected and ready, false otherwise.

    • Send a message to the WebSocket server. Supports multiple data types: string (JSON), array (binary/Loro update bytes), or object (JSON). If not connected, messages are queued up to maxQueueSize and sent when connection establishes. Queue overflow is silently dropped to prevent memory issues.

      Parameters

      • data: unknown

        The data to send (string, array, or object).

      Returns void

      Void.