Skip to content

Instantly share code, notes, and snippets.

@juanriaza
juanriaza / gist:4370122
Created December 24, 2012 17:32
javascript overload debug websockets
WebSocket.prototype._send = WebSocket.prototype.send;
WebSocket.prototype.send = function (data) {
console.log("\u2192 " + data);
this._send(data);
this.addEventListener('message', function (msg) {
console.log('\u2190 ' + msg.data);
}, false);
this.send = function (data) {
this._send(data);
console.log("\u2192 " + data);