Commit a72fee726d28007bf1961b22fe0be2a23f25851e
1 parent
fa7a3d69
1.websocket相关
Showing
2 changed files
with
2 additions
and
13 deletions
src/main/java/com/bsth/WebAppConfiguration.java
| ... | ... | @@ -76,17 +76,4 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS |
| 76 | 76 | registry.addHandler(new RealControlSocketHandler(), "/sockjs/realcontrol").addInterceptors(new WebSocketHandshakeInterceptor()) |
| 77 | 77 | .withSockJS(); |
| 78 | 78 | } |
| 79 | - | |
| 80 | - /** | |
| 81 | - * 增加websocket的输出缓冲区 | |
| 82 | - * @return | |
| 83 | - */ | |
| 84 | - @Bean | |
| 85 | - public ServletServerContainerFactoryBean createServletServerContainerFactoryBean() { | |
| 86 | - ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean(); | |
| 87 | - container.setMaxTextMessageBufferSize(52768); | |
| 88 | - container.setMaxBinaryMessageBufferSize(52768); | |
| 89 | - logger.info("Websocket factory returned"); | |
| 90 | - return container; | |
| 91 | - } | |
| 92 | 79 | } | ... | ... |
src/main/java/com/bsth/websocket/handler/RealControlSocketHandler.java
| ... | ... | @@ -50,6 +50,8 @@ public class RealControlSocketHandler implements WebSocketHandler { |
| 50 | 50 | @Override |
| 51 | 51 | public void afterConnectionEstablished(WebSocketSession session) |
| 52 | 52 | throws Exception { |
| 53 | + session.setBinaryMessageSizeLimit(52768); | |
| 54 | + session.setTextMessageSizeLimit(52768); | |
| 53 | 55 | users.add(session); |
| 54 | 56 | } |
| 55 | 57 | ... | ... |