diff --git a/types/websocket/index.d.ts b/types/websocket/index.d.ts index 0087c7a3d1..cd17039b1c 100644 --- a/types/websocket/index.d.ts +++ b/types/websocket/index.d.ts @@ -670,6 +670,35 @@ declare class router extends events.EventEmitter { } +declare class w3cwebsocket { + static CONNECTING: number; + static OPEN: number; + static CLOSING: number; + static CLOSED: number; + + url: string; + readyState: number; + protocol?: string; + extenstions: IExtension[]; + bufferedAmount: number; + + CONNECTING: number; + OPEN: number; + CLOSING: number; + CLOSED: number; + + onopen: () => void; + onerror: (error: Error) => void; + onclose: () => void; + onmessage: (message: any) => void; + + constructor(url: string, protocols?: string[], origin?: string, headers?: any[], requestOptions?: object, clientConfig?: IClientConfig); + + send(data: Buffer): void; + send(data: IStringified): void; + close(code?: number, reason?: string): void; +} + export declare var version: string; export declare var constants: { DEBUG: boolean;