import http from "node:http"; import Service from "../Service"; import type { ApiRequestMessage, NotifyApi } from "./ApiMessage"; interface Config { secure?: false; port: number; transformResponsePayload?: (payload: unknown, message: ApiRequestMessage) => unknown; transformRequestPayload?: (payload: unknown, message: ApiRequestMessage) => unknown; path?: string; paths?: string[]; pingPath?: string; logConnections?: boolean; } interface SecureConfig extends Omit { secure: true; keyPath: string; certPath: string; } declare class ApiService extends Service { private apiServiceConfig; private wsServer; private readonly _httpServer; private subscriptions; onHttpRequest: (req: http.IncomingMessage, res: http.ServerResponse & { req: http.IncomingMessage; }) => void; constructor(config: Config | SecureConfig); get httpServer(): http.Server; start(): Promise; stop(): Promise; logSubscriptions(): void; private addSubscription; private removeSubscription; private removeAllSubscriptions; /** * This is where WebSocket connections are established. Both the initial * HTTP request and the underlying MessageConnection abstraction are available * here as parameters. It is a convenient place to harvest headers from the * HTTP request for the purpose of storing connection-persisnet data. */ private onConnect; private onDisconnect; private checkAccess; private onReceiveClientMessage; } export default ApiService;