UNPKG

@x5e/gink

Version:

an eventually consistent database

26 lines (25 loc) 963 B
import { Server as HttpServer, ServerResponse, IncomingMessage } from "http"; import { Server as HttpsServer } from "https"; import { request as WebSocketRequest } from "websocket"; import { NumberStr, DirPath, CallBack, FilePath } from "./typedefs"; /** * Just a utility class to wrap websocket.server. */ export declare class Listener { ready: Promise<any>; private websocketServer; readonly httpServer: HttpServer | HttpsServer; readonly staticContentRoot?: string; readonly index?: string; constructor(args: { requestHandler: (request: WebSocketRequest) => void; requestListener?: (request: IncomingMessage, response: ServerResponse) => void; staticContentRoot?: DirPath; port?: NumberStr; logger?: CallBack; sslKeyFilePath?: FilePath; sslCertFilePath?: FilePath; index?: string; }); requestListener(request: IncomingMessage, response: ServerResponse): void; }