Skip to content Skip to sidebar Skip to footer

WebSocket Disconnected When Trying To Send Large Size Of Images

I am testing a WebSocket at localhost using java and javascirpt, running Tomcat 7.0.42 and no proxy in between. It works fine on sending text and small size of image via websocket.

Solution 1:

Finally, I found a solution for my question, what i did on Tomcat is to use:

    protected StreamInbound createWebSocketInbound(String string, HttpServletRequest hsr) {

    MyMessageInbound inbound = new MyMessageInbound();

    inbound.setByteBufferMaxSize(9999999);
    inbound.setOutboundByteBufferSize(9999999);

    return inbound;
}

But there is another problem is: what is the proper value I should use, here is 9999999, the value should be tested well when I upload under 8-9MB file using WebSocket, but why, how can I measure it? Please help and discuss here again, thx!


Solution 2:


Post a Comment for "WebSocket Disconnected When Trying To Send Large Size Of Images"