File tree Expand file tree Collapse file tree
backend/web/src/main/java/org/jumpserver/chen/web/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import org .jumpserver .chen .framework .ws .ConsoleWebSocketHandler ;
44import org .jumpserver .chen .framework .ws .DBConsoleWebsocketHandler ;
55import org .jumpserver .chen .framework .ws .SessionWebSocketHandler ;
6+ import org .springframework .context .annotation .Bean ;
67import org .springframework .context .annotation .Configuration ;
78import org .springframework .http .server .ServerHttpRequest ;
89import org .springframework .http .server .ServerHttpResponse ;
1112import org .springframework .web .socket .config .annotation .WebSocketConfigurer ;
1213import org .springframework .web .socket .config .annotation .WebSocketHandlerRegistry ;
1314import org .springframework .web .socket .server .HandshakeInterceptor ;
15+ import org .springframework .web .socket .server .standard .ServletServerContainerFactoryBean ;
1416
1517import java .util .Map ;
1618import java .util .Objects ;
1719
1820@ Configuration
1921@ EnableWebSocket
2022public class WebSocketConfig implements WebSocketConfigurer {
23+
24+
25+ @ Bean
26+ public ServletServerContainerFactoryBean createWebSocketContainer () {
27+ ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean ();
28+ container .setMaxTextMessageBufferSize (20 * 1024 * 1024 );
29+ container .setMaxBinaryMessageBufferSize (20 * 1024 * 1024 );
30+ // 可选:异步发送超时
31+ // container.setAsyncSendTimeout(20_000L);
32+ return container ;
33+ }
34+
35+
2136 @ Override
2237 public void registerWebSocketHandlers (WebSocketHandlerRegistry registry ) {
2338 registry
You can’t perform that action at this time.
0 commit comments