-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathws.d.ts
42 lines (39 loc) · 1.15 KB
/
ws.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/// <reference types="node" />
/**
* Describes the required shape of WebSocket instances.
* @interface WebSocketInstance
*/
export interface WebSocketInstance {
send: Function;
close: Function;
onmessage: Function | null;
onopen: Function | null;
onclose: Function | null;
onerror: Function | null;
}
/**
* Describes the required shape of WebSocket constructors.
* @interface WebSocketImpl
*/
export interface WebSocketImpl {
new(url: string, protocols?: string | string[], options?: any): WebSocketInstance;
}
export namespace ws {
export type connect = (Impl: WebSocketImpl) => (url: string, protocols: string | string[], options: any) => () => {
[x: string]: any;
connect: (port_ignore: any, host_ignore: any, options_ignore: any, callback: Function) => {
[x: string]: any;
end: () => void;
write: (data: any) => void;
on: (event: string, handler: Function) => void;
get_id_string: () => string;
}
};
export type wrap = (ws: any) => {
[x: string]: any;
end: () => void;
write: (data: any) => void;
on: (event: string, handler: Function) => void;
get_id_string: () => string;
}
}