forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sockjs-node.d.ts
57 lines (48 loc) · 1.71 KB
/
sockjs-node.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Type definitions for sockjs-node 0.3.x
// Project: https://github.com/sockjs/sockjs-node
// Definitions by: Phil McCloghry-Laing <https://github.com/pmccloghrylaing>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "sockjs" {
import http = require('http');
export interface ServerOptions {
sockjs_url?: string;
prefix?: string;
response_limit?: number;
websocket?: boolean;
jsessionid?: any;
log?: (severity: string, message: string) => void;
heartbeat_delay?: number;
disconnect_delay?: number;
}
export function createServer(options?: ServerOptions): Server;
export interface Server extends NodeJS.EventEmitter {
installHandlers(server: http.Server, options?: ServerOptions): any;
on(event: 'connection', listener: (conn: Connection) => any): Server;
on(event: string, listener: Function): Server;
}
export interface Connection extends NodeJS.ReadWriteStream {
remoteAddress: string;
remotePort: number;
address: {
[key: string]: {
address: string;
port: number;
};
};
headers: {
[key: string]: string;
};
url: string;
pathname: string;
prefix: string;
protocol: string;
readyState: number;
id: string;
close(code?: string, reason?: string): boolean;
destroy(): void;
on(event: 'data', listener: (message: string) => any): Connection;
on(event: 'close', listener: () => void): Connection;
on(event: string, listener: Function): Connection;
}
}