mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 11:02:11 +08:00
adds constructor to pass tests
Need two constructors because https://github.com/websockets/ws/blob/master/lib/WebSocket.js\#L58
This commit is contained in:
35
ws/ws.d.ts
vendored
35
ws/ws.d.ts
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user