UNPKG

@joker.front/cli

Version:

The Next-Generation Front-End Toolchain: Swift, Efficient, and Adaptive.

29 lines (28 loc) 871 B
import { Server, ServerOptions } from "."; import { WebSocket, ServerOptions as WsServerOptions } from "ws"; import { HMRType } from "./hmr"; export declare const HMR_HEADER_TAG = "joker-hmr"; export declare class SocketServer { private server; private wss; private clientMaps; wsOption: WsServerOptions; readonly timeout = 30000; private customPort; constructor(server: Server, config?: ServerOptions); get clients(): (WebSocketClient | undefined)[]; send(v1: HMRType.All | string, data?: any): Promise<void>; dispose(): Promise<any>; private initHandler; private getSocketClient; } export interface WebSocketClient { send(hmrType: HMRType.All): void; send(event: string, params: any): void; socket: WebSocket; } export type WebScoketClinetSendParam<T> = { type: string; event: string; data: T; };