Skip to content

Instantly share code, notes, and snippets.

@rudiedirkx
Last active August 29, 2015 14:15
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 rudiedirkx/9fc0ae7f35dd754369cd to your computer and use it in GitHub Desktop.
Save rudiedirkx/9fc0ae7f35dd754369cd to your computer and use it in GitHub Desktop.
javascript:
(function() {
WebSocket.sockets || (WebSocket.sockets = []);
var s = WebSocket.prototype.send;
WebSocket.prototype.send = function(data) {
if (!this._oh) {
this._oh = 1;
WebSocket.sockets.push(this);
this.addEventListener('message', function(e) {
console.log('receive', e.data);
});
}
console.log('send', data);
return s.apply(this, arguments);
};
})();
void(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment