/// import AsyncLock from 'async-lock'; import WebSocket from 'ws'; import { IncomingMessage as HTTPIncomingMessage } from 'http'; import { CloseEvent } from '@hocuspocus/common'; import Document from './Document'; import { MessageLogger } from './Debugger'; export declare class Connection { webSocket: WebSocket; context: any; document: Document; pingInterval: NodeJS.Timeout; pongReceived: boolean; request: HTTPIncomingMessage; timeout: number; callbacks: any; socketId: string; lock: AsyncLock; readOnly: Boolean; debugger: MessageLogger; /** * Constructor. */ constructor(connection: WebSocket, request: HTTPIncomingMessage, document: Document, timeout: number, socketId: string, context: any, readOnly?: boolean); /** * Set a callback that will be triggered when the connection is closed */ onClose(callback: (document: Document) => void): Connection; /** * Send the given message */ send(message: any): void; /** * Graceful wrapper around the WebSocket close method. */ close(event?: CloseEvent): void; /** * Check if pong was received and close the connection otherwise * @private */ private check; /** * Send the current document awareness to the client, if any * @private */ private sendCurrentAwareness; /** * Handle an incoming message * @private */ private handleMessage; /** * Get the underlying connection instance * @deprecated */ get instance(): WebSocket; /** * Get the underlying connection instance * @deprecated */ get connection(): WebSocket; } export default Connection;