title: What is the maximum size of data that can be passed through a WebSocket?
body: <p>I am new in Java <code>WebSocket</code>. When I tried to pass a <code>JSON</code> with length greater than <code>8192</code>, the websocket disconnected immediately. How ever <code>JSON</code> with length <code>&lt;= 8191</code> works fine. </p>
  
  <p><strong>Is there any <code>MAX SIZE/ LIMIT</code> of data that can be passed through a <code>WebSocket</code>? if yes, what's that size?</strong></p>
  
  <hr>
  
  <p><strong>I FIXED THE ERROR BY ADDING THESE LINES TO my <code>web.xml</code></strong></p>
  
  <pre><code>&lt;context-param&gt;
           &lt;param-name&gt;org.apache.tomcat.websocket.textBufferSize&lt;/param-name&gt;
           &lt;param-value&gt;32768&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
              &lt;param-name&gt;org.apache.tomcat.websocket.binaryBufferSize&lt;/param-name&gt;
              &lt;param-value&gt;32768&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p>Thanks @Davide Lorenzo MARINO.</p>