Socket.io 1.x - how to limit the message size for websites

I searched a lot, but did not find a solution. I want to limit the size of the released message for websites and NOT for HTTP transport. Socket.io has maxHttpBufferSizebut limits only the HTTP transport buffer.

here is the client code

    socket.emit('someevent', somedata);

and server code

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

I want to reject the connection if "sizeof (somedata)"> N kb. Verification must be performed before all data is received.

+4
source share

All Articles