Updated socket.io to have better function typing on SocketNamespace.on

This commit is contained in:
Andrew Gaspar
2013-08-15 14:43:56 -05:00
parent e4c97e410c
commit 85cba9f9b8
2 changed files with 11 additions and 1 deletions
+10
View File
@@ -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);
});
});
+1 -1
View File
@@ -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;