title: How to override WebSocket send() method
body: <p>I'm trying to override the <code>WebSocket.send()</code> method.
  My objective is being able to fuzz the sent data to test robustness of the server implementation.</p>
  
  <p>I'm adopting this approach:</p>
  
  <pre><code>// OVERRIDE WEBSOCKET SEND METHOD
  WebSocket.prototype.oldSend = WebSocket.prototype.send;
  
  WebSocket.prototype.send = function(data) {
       console.log("ws: sending data");
       WebSocket.prototype.oldSend(data);
  };
  </code></pre>
  
  <p>This fails when the <code>WebSocket.prototype.oldSend(data)</code> command is called the first time, with the error:
      Failed to send: 'send' called on an object that does not implement interface WebSocket.</p>
  
  <p>Anybody if it is possible to override the built-in websocket send method(), or what else I'm missing?</p>
  
  <p>TIA</p>