1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export = SockJS;
|
11 | export as namespace SockJS;
|
12 |
|
13 | declare const SockJS: {
|
14 | new (url: string, _reserved?: any, options?: SockJS.Options): WebSocket;
|
15 | (url: string, _reserved?: any, options?: SockJS.Options): WebSocket;
|
16 | prototype: WebSocket;
|
17 | CONNECTING: SockJS.CONNECTING;
|
18 | OPEN: SockJS.OPEN;
|
19 | CLOSING: SockJS.CLOSING;
|
20 | CLOSED: SockJS.CLOSED;
|
21 | };
|
22 |
|
23 | declare namespace SockJS {
|
24 | type CONNECTING = 0;
|
25 | type OPEN = 1;
|
26 | type CLOSING = 2;
|
27 | type CLOSED = 3;
|
28 |
|
29 | type State = CONNECTING | OPEN | CLOSING | CLOSED;
|
30 |
|
31 | interface BaseEvent extends Event {
|
32 | type: string;
|
33 | }
|
34 |
|
35 | type OpenEvent = BaseEvent;
|
36 |
|
37 | interface CloseEvent extends BaseEvent {
|
38 | code: number;
|
39 | reason: string;
|
40 | wasClean: boolean;
|
41 | }
|
42 |
|
43 | interface MessageEvent extends BaseEvent {
|
44 | data: string;
|
45 | }
|
46 |
|
47 | type SessionGenerator = () => string;
|
48 |
|
49 | interface Options {
|
50 | server?: string | undefined;
|
51 | sessionId?: number | SessionGenerator | undefined;
|
52 | transports?: string | string[] | undefined;
|
53 | timeout?: number | undefined;
|
54 | }
|
55 | }
|