diff --git a/ws/ws.d.ts b/ws/ws.d.ts index af0bb9a4ad..2b16bd52ea 100644 --- a/ws/ws.d.ts +++ b/ws/ws.d.ts @@ -34,21 +34,8 @@ declare module "ws" { onclose: (event: {wasClean: boolean; code: number; reason: string; target: WebSocket}) => void; onmessage: (event: {data: any; type: string; target: WebSocket}) => void; - constructor(address: string, protocols?: string | string[], options?: { - protocol?: string; - agent?: http.Agent; - headers?: {[key: string]: string}; - protocolVersion?: any; - host?: string; - origin?: string; - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any[]; - ciphers?: string; - rejectUnauthorized?: boolean; - }); + constructor(address: string, options?: WebSocket.IClientOptions); + constructor(address: string, protocols?: string | string[], options?: WebSocket.IClientOptions); close(code?: number, data?: any): void; pause(): void; @@ -92,7 +79,23 @@ declare module "ws" { type VerifyClientCallbackSync = (info: {origin: string; secure: boolean; req: http.ServerRequest}) => boolean; type VerifyClientCallbackAsync = (info: {origin: string; secure: boolean; req: http.ServerRequest} , callback: (res: boolean) => void) => void; - + + export interface IClientOptions { + protocol?: string; + agent?: http.Agent; + headers?: {[key: string]: string}; + protocolVersion?: any; + host?: string; + origin?: string; + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any[]; + ciphers?: string; + rejectUnauthorized?: boolean; + } + export interface IServerOptions { host?: string; port?: number;