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 | // Type definitions for sockjs 0.3
|
12 | // Project: https://github.com/sockjs/sockjs-node
|
13 | // Definitions by: Phil McCloghry-Laing <https://github.com/pmccloghrylaing>
|
14 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
15 |
|
16 | /// <reference types="node" />
|
17 |
|
18 | import http = require('http');
|
19 |
|
20 | export interface ServerOptions {
|
21 | sockjs_url?: string | undefined;
|
22 | prefix?: string | undefined;
|
23 | response_limit?: number | undefined;
|
24 | websocket?: boolean | undefined;
|
25 | jsessionid?: any;
|
26 | log?(severity: string, message: string): void;
|
27 | heartbeat_delay?: number | undefined;
|
28 | disconnect_delay?: number | undefined;
|
29 | }
|
30 |
|
31 | export function createServer(options?: ServerOptions): Server;
|
32 |
|
33 | export interface Server extends NodeJS.EventEmitter {
|
34 | installHandlers(server: http.Server, options?: ServerOptions): any;
|
35 |
|
36 | on(event: 'connection', listener: (conn: Connection) => any): this;
|
37 | on(event: string, listener: Function): this;
|
38 | }
|
39 |
|
40 | export interface Connection extends NodeJS.ReadWriteStream {
|
41 | remoteAddress: string;
|
42 | remotePort: number;
|
43 | address: {
|
44 | [key: string]: {
|
45 | address: string;
|
46 | port: number;
|
47 | };
|
48 | };
|
49 | headers: {
|
50 | [key: string]: string;
|
51 | };
|
52 | url: string;
|
53 | pathname: string;
|
54 | prefix: string;
|
55 | protocol: string;
|
56 | readyState: number;
|
57 | id: string;
|
58 |
|
59 | close(code?: string, reason?: string): boolean;
|
60 | destroy(): void;
|
61 |
|
62 | on(event: 'data', listener: (message: string) => any): this;
|
63 | on(event: 'close', listener: () => void): this;
|
64 | on(event: string, listener: Function): this;
|
65 | }
|
66 |
|
67 | ````
|
68 |
|
69 | ### Additional Details
|
70 | * Last updated: Tue, 06 Jul 2021 16:35:05 GMT
|
71 | * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
72 | * Global values: none
|
73 |
|
74 | # Credits
|
75 | These definitions were written by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing).
|
76 |
|
\ | No newline at end of file |