I'm just trying to figure out how I can call a javascript object method from within a method of the same object as below..
var testObject = {
method1 : function() {
var connectionAddr = "ws://localhost:8003";
socket = new WebSocket(connectionAddr);
socket.onmessage = function(event) {
method2();
}
},
method2: function() {
this.method1();
}
}
Changed my question as I realise when using this.method2() it is refering to the WebSocker object.