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