forked from lukeed/sockette
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsockette.d.ts
More file actions
23 lines (22 loc) · 724 Bytes
/
sockette.d.ts
File metadata and controls
23 lines (22 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
declare module "sockette" {
export default class Sockette {
constructor(url: string, options?: SocketteOptions);
send(data: any): void;
json(data: any): void;
close(code?: number, reason?: string): void;
reconnect(): void;
open(): void;
}
export interface SocketteOptions {
protocols?: string | string[];
timeout?: number;
maxAttempts?: number;
binaryType?: BinaryType;
onopen?: (this: Sockette, ev: Event) => any;
onmessage?: (this: Sockette, ev: MessageEvent) => any;
onreconnect?: (this: Sockette, ev: Event | CloseEvent) => any;
onmaximum?: (this: Sockette, ev: CloseEvent) => any;
onclose?: (this: Sockette, ev: CloseEvent) => any;
onerror?: (this: Sockette, ev: Event) => any;
}
}