/** * Copyright 2025 Angus.Fenying * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type * as $Net from 'node:net'; import type * as TLS from 'node:tls'; import * as $Events from 'node:events'; import type * as dL from '../Decl'; import * as cL from '../Constants'; import { WsFrameWriter } from './MessageWriter'; import { WritableOptions } from 'node:stream'; export interface IQueueItem { opcode: cL.EOpcode; data: any; cb: dL.IErrorCallback; } /** * The abstract class of WebSocket connection. * * @noInheritDoc */ export declare abstract class AbstractWsConnection extends $Events.EventEmitter implements dL.IWebSocket { readonly isServer: boolean; readonly tls: boolean; private _timeout; readonly frameReceiveMode: cL.EFrameReceiveMode; readonly maxMessageSize: number; protected readonly _writer: WsFrameWriter; private readonly _decoder; protected _socket: $Net.Socket | null; protected _writeStream: dL.IMessageWriter | null; protected _queue: IQueueItem[]; constructor(isServer: boolean, tls: boolean, _timeout: number, frameReceiveMode?: cL.EFrameReceiveMode, maxMessageSize?: number); get timeout(): number; set timeout(v: number); get finished(): boolean; get ended(): boolean; get connected(): boolean; get writable(): boolean; get family(): string; get remoteAddress(): string; get localAddress(): string; get remotePort(): number; get localPort(): number; get peerCertificate(): TLS.PeerCertificate | null; private _assertWritable; writeBinary(data: Buffer | string | Array, cb?: dL.IErrorCallback): boolean; writeText(data: Buffer | string | Array, cb?: dL.IErrorCallback): boolean; ping(data: Buffer | string | Array, cb?: dL.IErrorCallback): boolean; pong(data: Buffer | string | Array, cb?: dL.IErrorCallback): boolean; createMessageWriter(opcode: cL.EOpcode, opts?: WritableOptions): dL.IMessageWriter; private readonly _defaultWriteCallback; private _flushQueue; end(reason?: cL.ECloseReason, cb?: dL.IErrorCallback): boolean; destroy(): void; protected _setup(socket: $Net.Socket, earlyDataPayload: Buffer | null): void; private readonly _onSocketData; } //# sourceMappingURL=AbstractConnection.d.ts.map