1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import http = require('http');
|
9 |
|
10 | export interface ServerOptions {
|
11 | sockjs_url?: string | undefined;
|
12 | prefix?: string | undefined;
|
13 | response_limit?: number | undefined;
|
14 | websocket?: boolean | undefined;
|
15 | jsessionid?: any;
|
16 | log?(severity: string, message: string): void;
|
17 | heartbeat_delay?: number | undefined;
|
18 | disconnect_delay?: number | undefined;
|
19 | }
|
20 |
|
21 | export function createServer(options?: ServerOptions): Server;
|
22 |
|
23 | export interface Server extends NodeJS.EventEmitter {
|
24 | installHandlers(server: http.Server, options?: ServerOptions): any;
|
25 |
|
26 | on(event: 'connection', listener: (conn: Connection) => any): this;
|
27 | on(event: string, listener: Function): this;
|
28 | }
|
29 |
|
30 | export interface Connection extends NodeJS.ReadWriteStream {
|
31 | remoteAddress: string;
|
32 | remotePort: number;
|
33 | address: {
|
34 | [key: string]: {
|
35 | address: string;
|
36 | port: number;
|
37 | };
|
38 | };
|
39 | headers: {
|
40 | [key: string]: string;
|
41 | };
|
42 | url: string;
|
43 | pathname: string;
|
44 | prefix: string;
|
45 | protocol: string;
|
46 | readyState: number;
|
47 | id: string;
|
48 |
|
49 | close(code?: string, reason?: string): boolean;
|
50 | destroy(): void;
|
51 |
|
52 | on(event: 'data', listener: (message: string) => any): this;
|
53 | on(event: 'close', listener: () => void): this;
|
54 | on(event: string, listener: Function): this;
|
55 | }
|