Private_Disposable for cleaning up message handlers
Private_Current connection state
Binary data type for received messages
ReadonlybufferedAmount of buffered data waiting to be sent
ReadonlyclientUnique identifier for this WebSocket instance
ReadonlyCLOSEDWebSocket connection is closed
ReadonlyCLOSINGWebSocket connection is closing
ReadonlyCONNECTINGWebSocket is connecting
ReadonlyextensionsExtensions in use
ProtectedlistenersMap of event type to listener functions
ReadonlyOPENWebSocket connection is open and ready
ReadonlyprotocolSubprotocol in use
ReadonlyurlURL of the WebSocket endpoint
Private Static_Counter for generating unique client IDs
Static ReadonlyCLOSEDWebSocket connection is closed
Static ReadonlyCLOSINGWebSocket connection is closing
Static ReadonlyCONNECTINGWebSocket is connecting
Static ReadonlyOPENWebSocket connection is open and ready
Get the close event handler callback.
Set the close event handler callback.
The callback function to invoke when the connection closes
Get the error event handler callback.
Set the error event handler callback.
The callback function to invoke when an error occurs
Get the message event handler callback.
Set the message event handler callback.
The callback function to invoke when a message is received
Get the open event handler callback.
Set the open event handler callback.
The callback function to invoke when the connection opens
Get the current connection state of the WebSocket.
Private_PrivateHandle incoming messages from the extension. Routes WebSocket messages (open, message, close) to appropriate handlers.
The extension message containing WebSocket event data
True if the message was processed, false otherwise
Private_PrivateInitialize the WebSocket connection by sending an open request to the extension.
Register a listener function for a specific event type. The listener can later be invoked via the dispatchEvent method.
The type of event (e.g., 'open', 'message', 'close', 'error')
Callback function to invoke when an event of this type is dispatched
Dispatch an event to all registered listeners of that event type. Each listener is invoked with the event as the first argument, or with custom arguments if provided.
The event object to dispatch
Optional custom arguments to pass to listeners instead of the event
True if listeners were found and invoked, false otherwise
Unregister a listener function for a specific event type. The listener will no longer be invoked when events of this type are dispatched.
The type of event (e.g., 'open', 'message', 'close', 'error')
The callback function to remove
Fake WebSocket implementation that proxies through postMessage. Implements the standard WebSocket API but communicates with the VS Code extension instead of directly connecting to a server.