Skip to content

Instantly share code, notes, and snippets.

@alpgul
Last active February 5, 2019 08:43
Show Gist options
  • Save alpgul/3b7defce5bf3cc5dbaf19e2051a20bb3 to your computer and use it in GitHub Desktop.
Save alpgul/3b7defce5bf3cc5dbaf19e2051a20bb3 to your computer and use it in GitHub Desktop.
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);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment