Skip to content

Instantly share code, notes, and snippets.

@elventear
Forked from maskit/gist:2252422
Last active August 29, 2015 14:14
Show Gist options
  • Save elventear/0f8bc9c281f43faf267e to your computer and use it in GitHub Desktop.
Save elventear/0f8bc9c281f43faf267e to your computer and use it in GitHub Desktop.
Sniff WebSocket data
(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