diff --git a/socket.io/socket.io-tests.ts b/socket.io/legacy/socket.io-0.9-tests.ts similarity index 96% rename from socket.io/socket.io-tests.ts rename to socket.io/legacy/socket.io-0.9-tests.ts index 0b29890ca..40f0c6b89 100644 --- a/socket.io/socket.io-tests.ts +++ b/socket.io/legacy/socket.io-0.9-tests.ts @@ -1,24 +1,24 @@ -import io = require('socket.io'); - -var socketManager = io.listen(80); - -socketManager.sockets.on('connection', socket => { - socket.emit('news', { hello: 'world' }); - socket.on('my other event', data => { - console.log(data); - }); -}); - -// Storing data Associated to a client. -// Server side sample -io.listen(80).sockets.on('connection', function (socket) { - socket.on('set nickname', function (name) { - socket.set('nickname', name, function () { socket.emit('ready'); }); - }); - - socket.on('msg', function () { - socket.get('nickname', function (err, name) { - console.log('Chat message by ', name); - }); - }); +import io = require('socket.io'); + +var socketManager = io.listen(80); + +socketManager.sockets.on('connection', socket => { + socket.emit('news', { hello: 'world' }); + socket.on('my other event', data => { + console.log(data); + }); +}); + +// Storing data Associated to a client. +// Server side sample +io.listen(80).sockets.on('connection', function (socket) { + socket.on('set nickname', function (name) { + socket.set('nickname', name, function () { socket.emit('ready'); }); + }); + + socket.on('msg', function () { + socket.get('nickname', function (err, name) { + console.log('Chat message by ', name); + }); + }); }); \ No newline at end of file diff --git a/socket.io/socket.io-tests.ts.tscparams b/socket.io/legacy/socket.io-0.9-tests.ts.tscparams similarity index 50% rename from socket.io/socket.io-tests.ts.tscparams rename to socket.io/legacy/socket.io-0.9-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/socket.io/socket.io-tests.ts.tscparams +++ b/socket.io/legacy/socket.io-0.9-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/socket.io/socket.io.d.ts b/socket.io/legacy/socket.io-0.9.d.ts similarity index 96% rename from socket.io/socket.io.d.ts rename to socket.io/legacy/socket.io-0.9.d.ts index 184468b12..44edbb174 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/legacy/socket.io-0.9.d.ts @@ -1,70 +1,70 @@ -// Type definitions for socket.io -// Project: http://socket.io/ -// Definitions by: William Orr -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -/// - -declare module "socket.io" { - import http = require('http'); - - export function listen(server: http.Server, options: any, fn: Function): SocketManager; - export function listen(server: http.Server, fn?: Function): SocketManager; - export function listen(port: Number): SocketManager; - - - interface Socket { - id: string; - json:any; - log: any; - volatile: any; - broadcast: any; - handshake: any; - in(room: string): Socket; - to(room: string): Socket; - join(name: string, fn: Function): Socket; - leave(name: string, fn: Function): Socket; - set(key: string, value: any, fn: Function): Socket; - get(key: string, fn: Function): Socket; - has(key: string, fn: Function): Socket; - del(key: string, fn: Function): Socket; - disconnect(): Socket; - send(data: any, fn: Function): Socket; - emit(ev: any, ...data:any[]): Socket; - on(ns: string, fn: Function): Socket; - } - - interface SocketNamespace { - clients(room: string): Socket[]; - log: any; - store: any; - json: any; - volatile: any; - in(room: string): SocketNamespace; - on(evt: string, fn: (socket: Socket) => void): SocketNamespace; - to(room: string): SocketNamespace; - except(id: any): SocketNamespace; - send(data: any): any; - emit(ev: any, ...data:any[]): Socket; - socket(sid: any, readable: boolean): Socket; - authorization(fn: Function): SocketNamespace; - } - - interface SocketManager { - get(key: any): any; - set(key: any, value: any): SocketManager; - enable(key: any): SocketManager; - disable(key: any): SocketManager; - enabled(key: any): boolean; - disabled(key: any): boolean; - configure(env: string, fn: Function): SocketManager; - configure(fn: Function): SocketManager; - of(nsp: string): SocketNamespace; - on(ns: string, fn: Function): SocketManager; - sockets: SocketNamespace; - } - - -} - +// Type definitions for socket.io +// Project: http://socket.io/ +// Definitions by: William Orr +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare module "socket.io" { + import http = require('http'); + + export function listen(server: http.Server, options: any, fn: Function): SocketManager; + export function listen(server: http.Server, fn?: Function): SocketManager; + export function listen(port: Number): SocketManager; + + + interface Socket { + id: string; + json:any; + log: any; + volatile: any; + broadcast: any; + handshake: any; + in(room: string): Socket; + to(room: string): Socket; + join(name: string, fn: Function): Socket; + leave(name: string, fn: Function): Socket; + set(key: string, value: any, fn: Function): Socket; + get(key: string, fn: Function): Socket; + has(key: string, fn: Function): Socket; + del(key: string, fn: Function): Socket; + disconnect(): Socket; + send(data: any, fn: Function): Socket; + emit(ev: any, ...data:any[]): Socket; + on(ns: string, fn: Function): Socket; + } + + interface SocketNamespace { + clients(room: string): Socket[]; + log: any; + store: any; + json: any; + volatile: any; + in(room: string): SocketNamespace; + on(evt: string, fn: (socket: Socket) => void): SocketNamespace; + to(room: string): SocketNamespace; + except(id: any): SocketNamespace; + send(data: any): any; + emit(ev: any, ...data:any[]): Socket; + socket(sid: any, readable: boolean): Socket; + authorization(fn: Function): SocketNamespace; + } + + interface SocketManager { + get(key: any): any; + set(key: any, value: any): SocketManager; + enable(key: any): SocketManager; + disable(key: any): SocketManager; + enabled(key: any): boolean; + disabled(key: any): boolean; + configure(env: string, fn: Function): SocketManager; + configure(fn: Function): SocketManager; + of(nsp: string): SocketNamespace; + on(ns: string, fn: Function): SocketManager; + sockets: SocketNamespace; + } + + +} +