Added definition for sockjs-node

This commit is contained in:
Phil McCloghry-Laing
2014-03-18 12:49:45 +11:00
parent 7573f56bec
commit cbca947722
2 changed files with 57 additions and 0 deletions

View File

@@ -286,6 +286,7 @@ All definitions files include a header with the author and editors, so at some p
* [socket.io](http://socket.io) (by [William Orr](https://github.com/worr))
* [socket.io-client](http://socket.io) (by [Maido Kaara](https://github.com/v3rm0n))
* [SockJS](https://github.com/sockjs/sockjs-client) (by [Emil Ivanov](https://github.com/vladev))
* [sockjs-node](https://github.com/sockjs/sockjs-node) (by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing))
* [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
* [Spin](http://fgnass.github.com/spin.js/) (by [Boris Yankov](https://github.com/borisyankov))
* [sqlite3](https://github.com/mapbox/node-sqlite3) (by [Nick Malaguti](https://github.com/nmalaguti))

56
sockjs-node/sockjs-node.d.ts vendored Normal file
View File

@@ -0,0 +1,56 @@
// Type definitions for sockjs-node 0.3.x
// Project: https://github.com/sockjs/sockjs-node
// Definitions by: Phil McCloghry-Laing <https://github.com/pmccloghrylaing>
// DefinitelyTyped: 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;
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;
}
}