title: Socket.io 1.x - how to constrain emitted message size for websockets
body: <p>I've searched a lot but found no solution. I want to limit emitted message size for websockets and NOT for HTTP transport. Socket.io has <code>maxHttpBufferSize</code> but it limits only the buffer of HTTP transports.</p>
  
  <p>here is clientside code</p>
  
  <pre><code>    socket.emit('someevent', somedata);
  </code></pre>
  
  <p>and serverside code</p>
  
  <pre><code>    socket.on('someevent', function(data){
         // do something with data
      });
  </code></pre>
  
  <p>I want to reject the connection if "sizeof(somedata)">N kb. Checking should be done before all data is received.</p>