1 | # Installation
|
2 | > `npm install --save @types/sockjs`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for sockjs (https://github.com/sockjs/sockjs-node).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sockjs.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sockjs/index.d.ts)
|
10 | ````ts
|
11 | /// <reference types="node" />
|
12 |
|
13 | import http = require("http");
|
14 |
|
15 | export interface ServerOptions {
|
16 | sockjs_url?: string | undefined;
|
17 | prefix?: string | undefined;
|
18 | response_limit?: number | undefined;
|
19 | websocket?: boolean | undefined;
|
20 | jsessionid?: any;
|
21 | log?(severity: string, message: string): void;
|
22 | heartbeat_delay?: number | undefined;
|
23 | disconnect_delay?: number | undefined;
|
24 | }
|
25 |
|
26 | export function createServer(options?: ServerOptions): Server;
|
27 |
|
28 | export interface Server extends NodeJS.EventEmitter {
|
29 | installHandlers(server: http.Server, options?: ServerOptions): any;
|
30 |
|
31 | on(event: "connection", listener: (conn: Connection) => any): this;
|
32 | on(event: string, listener: Function): this;
|
33 | }
|
34 |
|
35 | export interface Connection extends NodeJS.ReadWriteStream {
|
36 | remoteAddress: string;
|
37 | remotePort: number;
|
38 | address: {
|
39 | [key: string]: {
|
40 | address: string;
|
41 | port: number;
|
42 | };
|
43 | };
|
44 | headers: {
|
45 | [key: string]: string;
|
46 | };
|
47 | url: string;
|
48 | pathname: string;
|
49 | prefix: string;
|
50 | protocol: string;
|
51 | readyState: number;
|
52 | id: string;
|
53 |
|
54 | close(code?: string, reason?: string): boolean;
|
55 | destroy(): void;
|
56 |
|
57 | on(event: "data", listener: (message: string) => any): this;
|
58 | on(event: "close", listener: () => void): this;
|
59 | on(event: string, listener: Function): this;
|
60 | }
|
61 |
|
62 | ````
|
63 |
|
64 | ### Additional Details
|
65 | * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
|
66 | * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
67 |
|
68 | # Credits
|
69 | These definitions were written by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing).
|
70 |
|
\ | No newline at end of file |