Created
February 9, 2016 02:13
-
-
Save NhanHo/b2b6f3b0928a484b4a3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WebSocket.prototype._send = WebSocket.prototype.send; | |
WebSocket.prototype.send = function (data) { | |
this._send(data); | |
this.addEventListener('message', function (msg) { | |
if (msg.data.indexOf('console')>0) { | |
messages = (JSON.parse(JSON.parse(msg.data.substring(1))[0])[1]).messages.log; | |
for (msg in messages) { | |
console.log(messages[msg]); | |
} | |
}; | |
}, false); | |
this.send = function (data) { | |
this._send(data); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment