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 | export = SockJS;
|
12 | export as namespace SockJS;
|
13 |
|
14 | declare const SockJS: {
|
15 | new(url: string, _reserved?: any, options?: SockJS.Options): WebSocket;
|
16 | (url: string, _reserved?: any, options?: SockJS.Options): WebSocket;
|
17 | prototype: WebSocket;
|
18 | CONNECTING: SockJS.CONNECTING;
|
19 | OPEN: SockJS.OPEN;
|
20 | CLOSING: SockJS.CLOSING;
|
21 | CLOSED: SockJS.CLOSED;
|
22 | };
|
23 |
|
24 | declare namespace SockJS {
|
25 | type CONNECTING = 0;
|
26 | type OPEN = 1;
|
27 | type CLOSING = 2;
|
28 | type CLOSED = 3;
|
29 |
|
30 | type State = CONNECTING | OPEN | CLOSING | CLOSED;
|
31 |
|
32 | interface BaseEvent extends Event {
|
33 | type: string;
|
34 | }
|
35 |
|
36 | type OpenEvent = BaseEvent;
|
37 |
|
38 | interface CloseEvent extends BaseEvent {
|
39 | code: number;
|
40 | reason: string;
|
41 | wasClean: boolean;
|
42 | }
|
43 |
|
44 | interface MessageEvent extends BaseEvent {
|
45 | data: string;
|
46 | }
|
47 |
|
48 | type SessionGenerator = () => string;
|
49 |
|
50 | interface Options {
|
51 | server?: string | undefined;
|
52 | sessionId?: number | SessionGenerator | undefined;
|
53 | transports?: string | string[] | undefined;
|
54 | timeout?: number | undefined;
|
55 | }
|
56 | }
|
57 |
|
58 | ````
|
59 |
|
60 | ### Additional Details
|
61 | * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
|
62 | * Dependencies: none
|
63 |
|
64 | # Credits
|
65 | 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).
|
66 |
|
\ | No newline at end of file |