DefinitelyTyped/types/sockjs/index.d.ts
Ben Davies 40d73b536f [sockjs] Delete sockjs, rename sockjs-node to sockjs, add tslint.json
@types/sockjs-node was impossible to use since the actual name of the
package it's meant for on npm is sockjs, not sockjs-node. @types/sockjs
already existed, however it was the type declaration file for an old
version of sockjs-client, which already has its own up-to-date type
declaration file under @types/sockjs-client.

Fixes #17112
2017-06-16 00:52:15 -03:00

56 lines
1.4 KiB
TypeScript

// Type definitions for sockjs 0.3
// Project: https://github.com/sockjs/sockjs-node
// Definitions by: Phil McCloghry-Laing <https://github.com/pmccloghrylaing>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
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): this;
on(event: string, listener: Function): this;
}
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): this;
on(event: 'close', listener: () => void): this;
on(event: string, listener: Function): this;
}