import { BaseHelper } from '../../../base/base.helper'; import { ValueOrPromise } from '../../../common/types'; import { dayjs } from '../../../utilities/date.utility'; import { ListenOptions, ServerOpts, Server as SocketServer, Socket as SocketClient } from 'node:net'; export interface ITcpSocketClient { id: string; socket: SocketClientType; state: 'unauthorized' | 'authenticating' | 'authenticated'; subscriptions: Set; storage: { connectedAt: dayjs.Dayjs; authenticatedAt: dayjs.Dayjs | null; [additionField: symbol | string]: any; }; } export interface ITcpSocketServerOptions { scope?: string; identifier: string; serverOptions: Partial; listenOptions: Partial; authenticateOptions: { required: boolean; duration?: number; }; extraEvents?: Record ValueOrPromise>; createServerFn: (options: Partial, connectionListener: (socket: SocketClientType) => void) => SocketServerType; onServerReady?: (opts: { server: SocketServerType; }) => void; onClientConnected?: (opts: { id: string; socket: SocketClientType; }) => void; onClientData?: (opts: { id: string; socket: SocketClientType; data: Buffer | string; }) => void; onClientClose?: (opts: { id: string; socket: SocketClientType; }) => void; onClientError?: (opts: { id: string; socket: SocketClientType; error: Error; }) => void; } export declare class BaseNetworkTcpServer extends BaseHelper { protected serverOptions: Partial; protected listenOptions: Partial; protected authenticateOptions: { required: boolean; duration?: number; }; protected clients: Record>; protected server: SocketServerType; protected extraEvents: Record ValueOrPromise>; protected createServerFn: (options: Partial, connectionListener: (socket: SocketClientType) => void) => SocketServerType; protected onServerReady?: (opts: { server: SocketServerType; }) => void; protected onClientConnected?: (opts: { id: string; socket: SocketClientType; }) => void; protected onClientData?: (opts: { id: string; socket: SocketClientType; data: Buffer | string; }) => void; protected onClientClose?: (opts: { id: string; socket: SocketClientType; }) => void; protected onClientError?: (opts: { id: string; socket: SocketClientType; error: Error; }) => void; constructor(opts: ITcpSocketServerOptions); configure(): void; onNewConnection(opts: { socket: SocketClientType; }): void; getClients(): Record>; getClient(opts: { id: string; }): ITcpSocketClient; getServer(): SocketServerType; doAuthenticate(opts: { id: string; state: 'unauthorized' | 'authenticating' | 'authenticated'; }): void; emit(opts: { clientId: string; payload: Buffer | string; }): void; } //# sourceMappingURL=base-tcp-server.helper.d.ts.map