diff --git a/types/ws/index.d.ts b/types/ws/index.d.ts index 1231d5af97..b99f9e4d88 100644 --- a/types/ws/index.d.ts +++ b/types/ws/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ws 5.1 +// Type definitions for ws 6.0 // Project: https://github.com/websockets/ws // Definitions by: Paul Loyd // Matt Silverlock @@ -120,7 +120,7 @@ declare namespace WebSocket { * whether or not to accept the handshake. */ type VerifyClientCallbackAsync = (info: { origin: string; secure: boolean; req: http.IncomingMessage } - , callback: (res: boolean, code?: number, message?: string) => void) => void; + , callback: (res: boolean, code?: number, message?: string, headers?: http.OutgoingHttpHeaders) => void) => void; interface ClientOptions { protocol?: string; @@ -149,8 +149,17 @@ declare namespace WebSocket { clientNoContextTakeover?: boolean; serverMaxWindowBits?: number; clientMaxWindowBits?: number; - level?: number; - memLevel?: number; + zlibDeflateOptions?: { + flush?: number; + finishFlush?: number; + chunkSize?: number; + windowBits?: number; + level?: number; + memLevel?: number; + strategy?: number; + dictionary?: Buffer | Buffer[] | DataView; + info?: boolean; + }; threshold?: number; concurrencyLimit?: number; } diff --git a/types/ws/ws-tests.ts b/types/ws/ws-tests.ts index 1b30da48ed..bc62d9de98 100644 --- a/types/ws/ws-tests.ts +++ b/types/ws/ws-tests.ts @@ -88,7 +88,20 @@ import * as https from 'https'; clientNoContextTakeover: true, serverMaxWindowBits: 0, clientMaxWindowBits: 0, - memLevel: 0 + zlibDeflateOptions: { + flush: 0, + finishFlush: 0, + chunkSize: 0, + windowBits: 0, + level: 0, + memLevel: 0, + strategy: 0, + dictionary: new Buffer('test'), + info: false + } + }, + verifyClient: (info: any, cb: any) => { + cb(true, 123, 'message', { Upgrade: "websocket" }); } }); }