2023-06-11 15:10:34 +10:00
|
|
|
/// <reference types="node" />
|
2024-04-03 20:15:11 +11:00
|
|
|
import http, { IncomingMessage } from "node:http";
|
2024-08-05 20:33:00 +10:00
|
|
|
import { HttpServerHelper } from "@spt/helpers/HttpServerHelper";
|
|
|
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
|
|
|
import { IWebSocketConnectionHandler } from "@spt/servers/ws/IWebSocketConnectionHandler";
|
|
|
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
|
|
|
import { JsonUtil } from "@spt/utils/JsonUtil";
|
|
|
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
|
|
|
import { Server, WebSocket } from "ws";
|
2023-06-11 15:10:34 +10:00
|
|
|
export declare class WebSocketServer {
|
|
|
|
protected logger: ILogger;
|
|
|
|
protected randomUtil: RandomUtil;
|
2023-10-09 20:21:00 +11:00
|
|
|
protected jsonUtil: JsonUtil;
|
2024-08-05 20:33:00 +10:00
|
|
|
protected localisationService: LocalisationService;
|
2023-06-11 15:10:34 +10:00
|
|
|
protected httpServerHelper: HttpServerHelper;
|
2024-08-05 20:33:00 +10:00
|
|
|
protected webSocketConnectionHandlers: IWebSocketConnectionHandler[];
|
|
|
|
protected webSocketServer: Server;
|
|
|
|
constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, httpServerHelper: HttpServerHelper, webSocketConnectionHandlers: IWebSocketConnectionHandler[]);
|
|
|
|
getWebSocketServer(): Server;
|
2023-06-11 15:10:34 +10:00
|
|
|
setupWebSocket(httpServer: http.Server): void;
|
|
|
|
protected getRandomisedMessage(): string;
|
2024-08-05 20:33:00 +10:00
|
|
|
protected wsOnConnection(ws: WebSocket, req: IncomingMessage): void;
|
2023-06-11 15:10:34 +10:00
|
|
|
}
|