问题:
WebSocket传输内容过长时报错:
1009|The decoded text message was too big for the output buffer and the endpoint does not support partial messages|true
解决:
tomcat项目中在web.xml中加上配置
<context-param>
<param-name>org.apache.tomcat.websocket.textBufferSize</param-name>
<param-value>1024000</param-value>
</context-param>
springboot项目中没有web.xml解决如下:
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class WebSocketConfig implements ServletContextInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
System.out.println("org.apache.tomcat.websocket.textBufferSize");
servletContext.addListener(WebAppRootListener.class);
servletContext.setInitParameter("org.apache.tomcat.websocket.textBufferSize","1024000");
servletContext.setInitParameter("org.apache.tomcat.websocket.binaryBufferSize","1024000");
}
}