forked from afrad/angular2-websocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular2-websocket.d.ts
44 lines (44 loc) · 1.45 KB
/
angular2-websocket.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
43
44
import { Observable } from "rxjs/Observable";
export interface WebSocketConfig {
initialTimeout: number;
maxTimeout: number;
reconnectIfNotNormalClose: boolean;
}
export declare class $WebSocket {
private url;
private protocols;
private config;
private reconnectAttempts;
private sendQueue;
private onOpenCallbacks;
private onMessageCallbacks;
private onErrorCallbacks;
private onCloseCallbacks;
private readyStateConstants;
private normalCloseCode;
private reconnectableStatusCodes;
private socket;
private internalConnectionState;
constructor(url: string, protocols: Array<string>, config?: WebSocketConfig);
connect(force?: boolean): Observable<{}>;
static create(url: string, protocols: Array<string>): WebSocket;
onOpenHandler(event: Event): void;
notifyOpenCallbacks(event: any): void;
fireQueue(): void;
notifyCloseCallbacks(event: any): void;
notifyErrorCallbacks(event: any): void;
onOpen(cb: any): this;
onClose(cb: any): this;
onError(cb: any): this;
onMessage(callback: any, options: any): this;
onMessageHandler(message: MessageEvent): void;
onCloseHandler(event: CloseEvent): void;
onErrorHandler(event: any): void;
send(data: any): void;
reconnect(): this;
close(force: boolean): this;
getBackoffDelay(attempt: any): number;
setInternalState(state: any): void;
getReadyState(): number;
setReadyState(): void;
}