1 | # Installation
|
2 | > `npm install --save @types/sockjs-client`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for sockjs-client (https://github.com/sockjs/sockjs-client).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sockjs-client.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sockjs-client/index.d.ts)
|
10 | ````ts
|
11 | // Type definitions for sockjs-client 1.5
|
12 | // Project: https://github.com/sockjs/sockjs-client, http://sockjs.org
|
13 | // Definitions by: Emil Ivanov <https://github.com/vladev>
|
14 | // Alexander Rusakov <https://github.com/arusakov>
|
15 | // BendingBender <https://github.com/BendingBender>
|
16 | // Soner Köksal <https://github.com/renjfk>
|
17 | // Alexander Putilov <https://github.com/PutilovAI>
|
18 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
19 |
|
20 | export = SockJS;
|
21 | export as namespace SockJS;
|
22 |
|
23 | declare const SockJS: {
|
24 | new (url: string, _reserved?: any, options?: SockJS.Options): WebSocket;
|
25 | (url: string, _reserved?: any, options?: SockJS.Options): WebSocket;
|
26 | prototype: WebSocket;
|
27 | CONNECTING: SockJS.CONNECTING;
|
28 | OPEN: SockJS.OPEN;
|
29 | CLOSING: SockJS.CLOSING;
|
30 | CLOSED: SockJS.CLOSED;
|
31 | };
|
32 |
|
33 | declare namespace SockJS {
|
34 | type CONNECTING = 0;
|
35 | type OPEN = 1;
|
36 | type CLOSING = 2;
|
37 | type CLOSED = 3;
|
38 |
|
39 | type State = CONNECTING | OPEN | CLOSING | CLOSED;
|
40 |
|
41 | interface BaseEvent extends Event {
|
42 | type: string;
|
43 | }
|
44 |
|
45 | type OpenEvent = BaseEvent;
|
46 |
|
47 | interface CloseEvent extends BaseEvent {
|
48 | code: number;
|
49 | reason: string;
|
50 | wasClean: boolean;
|
51 | }
|
52 |
|
53 | interface MessageEvent extends BaseEvent {
|
54 | data: string;
|
55 | }
|
56 |
|
57 | type SessionGenerator = () => string;
|
58 |
|
59 | interface Options {
|
60 | server?: string | undefined;
|
61 | sessionId?: number | SessionGenerator | undefined;
|
62 | transports?: string | string[] | undefined;
|
63 | timeout?: number | undefined;
|
64 | }
|
65 | }
|
66 |
|
67 | ````
|
68 |
|
69 | ### Additional Details
|
70 | * Last updated: Tue, 06 Jul 2021 16:35:05 GMT
|
71 | * Dependencies: none
|
72 | * Global values: `SockJS`
|
73 |
|
74 | # Credits
|
75 | These definitions were written by [Emil Ivanov](https://github.com/vladev), [Alexander Rusakov](https://github.com/arusakov), [BendingBender](https://github.com/BendingBender), [Soner Köksal](https://github.com/renjfk), and [Alexander Putilov](https://github.com/PutilovAI).
|
76 |
|
\ | No newline at end of file |