Socket.io 1.x - how to constrain emitted message size for websockets

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 maxHttpBufferSize but it limits only the buffer of HTTP transports.

here is clientside code

    socket.emit('someevent', somedata);

and serverside code

    socket.on('someevent', function(data){
       // do something with data
    });

I want to reject the connection if "sizeof(somedata)">N kb. Checking should be done before all data is received.