Quellcode durchsuchen

add websocket config property : hsweb.websocket

zhou-hao vor 7 Jahren
Ursprung
Commit
13ec2a6b5f

+ 10 - 0
hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/starter/CommandWebSocketAutoConfiguration.java

@@ -23,6 +23,7 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.socket.config.annotation.WebSocketConfigurationSupport;
 import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
+import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;
 
 import java.util.List;
 
@@ -77,6 +78,15 @@ public class CommandWebSocketAutoConfiguration {
         }
     }
 
+    @Bean
+    @ConfigurationProperties(prefix = "hsweb.websocket")
+    public ServletServerContainerFactoryBean createServletServerContainerFactoryBean() {
+        ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
+        container.setMaxTextMessageBufferSize(10_1024_1024);
+        container.setMaxBinaryMessageBufferSize(10_1024_1024);
+        return container;
+    }
+
     @Configuration
     @ConfigurationProperties(prefix = "hsweb.websocket")
     public static class HandlerConfigruation extends WebSocketConfigurationSupport {