Created
April 19, 2019 18:19
-
-
Save cppio/8003ebc505fedf2dc41830df76bba42e to your computer and use it in GitHub Desktop.
Log WebSocket calls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ((prototype, CONNECTING, OPEN, CLOSING, CLOSED) => { | |
| WebSocket = function() { | |
| const ws = new prototype.constructor(...arguments); | |
| console.trace("new WebSocket", arguments, "=>", ws); | |
| ws.addEventListener("message", event => console.log(event.data)); | |
| return ws; | |
| }; | |
| WebSocket.prototype = prototype; | |
| WebSocket.CONNECTING = CONNECTING; | |
| WebSocket.OPEN = OPEN; | |
| WebSocket.CLOSING = CLOSING; | |
| WebSocket.CLOSED = CLOSED; | |
| })(WebSocket.prototype, WebSocket.CONNECTING, WebSocket.OPEN, WebSocket.CLOSING, WebSocket.CLOSED); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment