import IOBuffer from './iobuffer'; /** * The WebSocket connection is the main class that holds a connection between the client and the server */ declare class WebSocketConnection { private _open; private _wsOpen; private _closingPromise; private readonly _onMessage; private readonly _onError; private readonly _pendingRequests; private readonly _ws; /** * This constructor should not be called directly * * @param url the URL of the remote MillenniumDB server * @param onMessage the callback that will handle the received data */ constructor(url: URL, onMessage: (iobuffer: IOBuffer) => void, onError: (error: string) => void); /** * Write a request. If the connection is not established yet, it will be enqueued * @param iobuffer a buffer containing the request */ write(iobuffer: IOBuffer): void; /** * Close the connection * @returns Promise that will be resolved when the connection is closed */ close(): Promise; private _safeCloseWebSocket; private _ensureOpen; /** * Create the WebSocket instance for the connection * @returns the WebSocket instance */ private _createWebSocket; } export default WebSocketConnection;