I'm using the Definitely Typed typescript definition file for socketio, but I am having scope issues when trying to bind events.
module testScope {
    import Socket = SocketIOClient.Socket;
    export class testClass {
        socket: Socket;
        constructor(){
            this.socket = io.connect();
            this.socket.on('test', this.testCallback);
        }
        testCallback(){
            console.log(this);
        }
    }
}
The console.log call outputs a Socket object instead of a testClass object. Any way I can fix this? If possible, without adding another layer of events system.
Doing it this way is also a no go, has "this" has no method testCallback:
module testScope {
    import Socket = SocketIOClient.Socket;
    export class testClass {
        socket: Socket;
        constructor(){
            this.socket = io.connect();
            this.socket.on('test', function(){ this.testCallback(); });
        }
        testCallback(){
            console.log(this);
        }
    }
}
 
     
    