Skip to content

Instantly share code, notes, and snippets.

@tomcask
Created January 27, 2016 13:35
Show Gist options
  • Save tomcask/00acb86faa74a5d83783 to your computer and use it in GitHub Desktop.
Save tomcask/00acb86faa74a5d83783 to your computer and use it in GitHub Desktop.
(function () {
WebSocket.prototype._send = WebSocket.prototype.send;
WebSocket.prototype.send = function (data) {
this._send(data);
this.addEventListener('message', function (msg) {
console.log('>> ' + msg.data);
}, false);
this.send = function (data) {
this._send(data);
console.log("<< " + data);
};
console.log("<< " + data);
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment