Skip to content

Instantly share code, notes, and snippets.

@c7tincu
Last active December 22, 2015 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c7tincu/ac8ccfc190fde7547ec4 to your computer and use it in GitHub Desktop.
Save c7tincu/ac8ccfc190fde7547ec4 to your computer and use it in GitHub Desktop.
WebSocket.prototype.oldSendImpl = WebSocket.prototype.send;
WebSocket.prototype.send =
function (data) {
console.log("\u2192 " + data);
this.oldSendImpl(data);
this.addEventListener(
"message",
function (msg) {
console.log("\u2190 " + msg.data);
},
false
);
this.send =
function (data) {
this.oldSendImpl(data);
console.log("\u2192 " + data);
};
};
@c7tincu
Copy link
Author

c7tincu commented Sep 4, 2013

Don’t use this in a production environment… ☺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment