diff --git a/socket.io/socket.io-tests.ts b/socket.io/socket.io-tests.ts new file mode 100644 index 000000000..841266610 --- /dev/null +++ b/socket.io/socket.io-tests.ts @@ -0,0 +1,10 @@ +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); + }); +}); \ No newline at end of file diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index d20b0540a..2b44ff6ab 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -40,7 +40,7 @@ interface SocketNamespace { json: any; volatile: any; in(room: string): SocketNamespace; - on(evt: string, fn: Function): SocketNamespace; + on(evt: string, fn: (socket: Socket) => void): SocketNamespace; to(room: string): SocketNamespace; except(id: any): SocketNamespace; send(data: any): any;