Spring Boot Stomp WebSocket

6
我似乎遇到了一个问题,卡在嵌入式Tomcat的stomp websocket消息大小限制 8k 上。
从服务器向客户端发送消息时,我会收到以下错误。根据我阅读的文档,Tomcat对通过WebSockets传输的消息有一个8k的限制,但我也读到过Stomp可以发送部分消息并让客户端重新组合它们,这似乎并没有发生。
消息永远不会传递到客户端处理程序,所以我相当有信心问题出在我的WebSocketConfig中,但是无论我尝试什么参数,都不能解决 A)8k消息大小限制和/或B)如果超过缓冲区限制,则将其分为部分消息块。
两边都有以下错误代码。
[code=1009, reason=The decoded text message was too big for the output buffer and the endpoint does not support partial messages]

我相信我错过了一些简单的东西,但似乎无法明确。感谢您的帮助!

服务器端 Stomp WebSocket 配置

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {


private static final Logger logger = LoggerFactory.getLogger(WebSocketConfig.class);



@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker(
            "/resp",
            "/not", 
            "/sub"
        );
    config.setApplicationDestinationPrefixes("/admin");
    config.setUserDestinationPrefix("/admin");

}


@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
    RequestUpgradeStrategy upgradeStrategy = new TomcatRequestUpgradeStrategy();
    registry.addEndpoint("/cmd",
                        "/connect")
                        .setHandshakeHandler(new DefaultHandshakeHandler(upgradeStrategy))
                        .setAllowedOrigins("*")
                        .withSockJS();




}

@Override
public boolean configureMessageConverters(List<MessageConverter> messageConverters) {
    messageConverters.add(new org.springframework.messaging.converter.StringMessageConverter());
    return true;
}


@Override
public void configureWebSocketTransport(WebSocketTransportRegistration registration) {
    registration.setSendTimeLimit(15*1000);
    registration.setMessageSizeLimit(16*1024);
    registration.setSendBufferSizeLimit(16*1024);


}

@Bean
public ServletServerContainerFactoryBean createServletServerContainerFactoryBean() {
    ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();

    container.setMaxTextMessageBufferSize(16*1024);
    container.setMaxBinaryMessageBufferSize(16*1024);
    logger.info("Websocket factory returned");
    ContainerProvider.getWebSocketContainer().setDefaultMaxTextMessageBufferSize(20*1024);
    return container;
}

}

服务器端跟踪消息

2016-01-27 18:20:54.342 DEBUG 3358 --- [clientInboundChannel-13] o.s.m.s.b.SimpleBrokerMessageHandler     : Processing MESSAGE destination=/sub/user-user5e1cc9e1c97a450180ed6ad41d575a33 session=5e1cc9e1c97a450180ed6ad41d575a33 user=core payload={"headers":{"deviceSessionId":"67669nys","message-id":"bf8Pcpx"},"payload":"{\"t...(truncated)
2016-01-27 18:20:54.342 DEBUG 3358 --- [clientInboundChannel-13] o.s.m.s.b.SimpleBrokerMessageHandler     : Broadcasting to 1 sessions.
2016-01-27 18:20:54.342  INFO 3358 --- [clientInboundChannel-13] c.l.a.c.AdminProfileController           : Response sent: /channelList
2016-01-27 18:20:54.342 TRACE 3358 --- [clientInboundChannel-13] o.s.m.h.i.InvocableHandlerMethod         : Method [processObject] returned [null]
2016-01-27 18:20:54.342 TRACE 3358 --- [clientOutboundChannel-3] o.s.messaging.simp.stomp.StompEncoder    : Encoding STOMP MESSAGE, headers={apiVersion=[5], message-id=[bf8Pcpx], destination=[/admin/sub/user], content-type=[text/plain;charset=UTF-8], subscription=[0]}
2016-01-27 18:20:54.343 TRACE 3358 --- [clientOutboundChannel-3] s.w.s.s.t.s.WebSocketServerSockJsSession : Cancelling heartbeat in session 5e1cc9e1c97a450180ed6ad41d575a33
2016-01-27 18:20:54.346 TRACE 3358 --- [clientOutboundChannel-3] s.w.s.s.t.s.WebSocketServerSockJsSession : Preparing to write SockJsFrame content='a["MESSAGE\napiVersion:5\nmessage-id:bf8Pcpx\ndestination:/admin/sub/user\nconte...(truncated)'
2016-01-27 18:20:54.347 TRACE 3358 --- [clientOutboundChannel-3] s.w.s.s.t.s.WebSocketServerSockJsSession : Writing SockJsFrame content='a["MESSAGE\napiVersion:5\nmessage-id:bf8Pcpx\ndestination:/admin/sub/user\nconte...(truncated)'
2016-01-27 18:20:54.347 TRACE 3358 --- [clientOutboundChannel-3] o.s.w.s.adapter.NativeWebSocketSession   : Sending TextMessage payload=[a["MESSAGE..], byteCount=20097, last=true], StandardWebSocketSession[id=0, uri=/admin/connect/401/5e1cc9e1c97a450180ed6ad41d575a33/websocket]
2016-01-27 18:20:54.373 TRACE 3358 --- [clientOutboundChannel-3] s.w.s.s.t.s.WebSocketServerSockJsSession : Scheduled heartbeat in session 5e1cc9e1c97a450180ed6ad41d575a33
2016-01-27 18:20:54.373 TRACE 3358 --- [http-nio-8084-exec-6] s.w.s.s.t.s.WebSocketServerSockJsSession : Cancelling heartbeat in session 5e1cc9e1c97a450180ed6ad41d575a33
2016-01-27 18:20:54.373 DEBUG 3358 --- [http-nio-8084-exec-6] s.w.s.h.LoggingWebSocketHandlerDecorator : WebSocketServerSockJsSession[id=5e1cc9e1c97a450180ed6ad41d575a33] closed with CloseStatus[code=1009, reason=The decoded text message was too big for the output buffer and the endpoint does not support partial messages]
2016-01-27 18:20:54.373 DEBUG 3358 --- [http-nio-8084-exec-6] o.s.w.s.m.SubProtocolWebSocketHandler    : Clearing session 5e1cc9e1c97a450180ed6ad41d575a33
2016-01-27 18:20:54.374 TRACE 3358 --- [http-nio-8084-exec-6] ationConfigEmbeddedWebApplicationContext : Publishing event in org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@648c94da: SessionDisconnectEvent[sessionId=5e1cc9e1c97a450180ed6ad41d575a33, CloseStatus[code=1009, reason=The decoded text message was too big for the output buffer and the endpoint does not support partial messages]]
 2016-01-27 18:20:54.374 DEBUG 3358 --- [http-nio-8084-exec-6] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 

客户端错误堆栈
2016-01-28 09:33:14.342 ERROR 810 --- [lient-AsyncIO-1] o.s.w.s.s.c.WebSocketClientSockJsSession : Transport error in WebSocketClientSockJsSession[id='c5c680b9a75e488ba7bb129f90b700e6, url=ws://localhost:8084/admin/connect]

java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: Unable to write the complete message as the WebSocket connection has been closed
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:282) ~[tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsSession.sendCloseMessage(WsSession.java:584) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsSession.doClose(WsSession.java:488) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsSession.close(WsSession.java:455) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient.close(WsFrameClient.java:94) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient.access$100(WsFrameClient.java:31) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:134) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:108) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126) [na:1.8.0_45]
at sun.nio.ch.Invoker.invokeDirect(Invoker.java:157) [na:1.8.0_45]
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.implRead(UnixAsynchronousSocketChannelImpl.java:553) [na:1.8.0_45]
at sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:276) [na:1.8.0_45]
at sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:297) [na:1.8.0_45]
at java.nio.channels.AsynchronousSocketChannel.read(AsynchronousSocketChannel.java:420) [na:1.8.0_45]
at org.apache.tomcat.websocket.AsyncChannelWrapperNonSecure.read(AsyncChannelWrapperNonSecure.java:52) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient.processSocketRead(WsFrameClient.java:79) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient.access$300(WsFrameClient.java:31) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:125) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:108) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126) [na:1.8.0_45]
at sun.nio.ch.Invoker$2.run(Invoker.java:218) [na:1.8.0_45]
at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Unable to write the complete message as the WebSocket connection has been closed
at org.apache.tomcat.websocket.FutureToSendHandler.get(FutureToSendHandler.java:102) ~[tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:275) ~[tomcat-embed-websocket-8.0.30.jar:8.0.30]
... 24 common frames omitted
Caused by: java.io.IOException: Unable to write the complete message as the WebSocket connection has been closed
at org.apache.tomcat.websocket.WsSession.registerFuture(WsSession.java:658) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.FutureToSendHandler.get(FutureToSendHandler.java:92) ~[tomcat-embed-websocket-8.0.30.jar:8.0.30]
... 25 common frames omitted

2016-01-28 09:33:14.343  WARN 810 --- [lient-AsyncIO-1] l.e.c.w.CustomDefaultStompSessionHandler : handleTransportError

java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: Unable to write the complete message as the WebSocket connection has been closed
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:282) ~[tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsSession.sendCloseMessage(WsSession.java:584) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsSession.doClose(WsSession.java:488) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsSession.close(WsSession.java:455) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient.close(WsFrameClient.java:94) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient.access$100(WsFrameClient.java:31) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:134) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:108) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126) [na:1.8.0_45]
at sun.nio.ch.Invoker.invokeDirect(Invoker.java:157) [na:1.8.0_45]
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.implRead(UnixAsynchronousSocketChannelImpl.java:553) [na:1.8.0_45]
at sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:276) [na:1.8.0_45]
at sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:297) [na:1.8.0_45]
at java.nio.channels.AsynchronousSocketChannel.read(AsynchronousSocketChannel.java:420) [na:1.8.0_45]
at org.apache.tomcat.websocket.AsyncChannelWrapperNonSecure.read(AsyncChannelWrapperNonSecure.java:52) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient.processSocketRead(WsFrameClient.java:79) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient.access$300(WsFrameClient.java:31) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:125) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:108) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126) [na:1.8.0_45]
at sun.nio.ch.Invoker$2.run(Invoker.java:218) [na:1.8.0_45]
at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Unable to write the complete message as the WebSocket connection has been closed
at org.apache.tomcat.websocket.FutureToSendHandler.get(FutureToSendHandler.java:102) ~[tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:275) ~[tomcat-embed-websocket-8.0.30.jar:8.0.30]
... 24 common frames omitted
Caused by: java.io.IOException: Unable to write the complete message as the WebSocket connection has been closed
at org.apache.tomcat.websocket.WsSession.registerFuture(WsSession.java:658) [tomcat-embed-websocket-8.0.30.jar:8.0.30]
at org.apache.tomcat.websocket.FutureToSendHandler.get(FutureToSendHandler.java:92) ~[tomcat-embed-websocket-8.0.30.jar:8.0.30]
... 25 common frames omitted

java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: Unable to write the complete message as the WebSocket connection has been closed
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:282)
at org.apache.tomcat.websocket.WsSession.sendCloseMessage(WsSession.java:584)
at org.apache.tomcat.websocket.WsSession.doClose(WsSession.java:488)
at org.apache.tomcat.websocket.WsSession.close(WsSession.java:455)
at org.apache.tomcat.websocket.WsFrameClient.close(WsFrameClient.java:94)
**2016-01-28 09:33:14.345 DEBUG 810 --- [lient-AsyncIO-1] o.s.w.s.s.c.WebSocketClientSockJsSession : Transport closed with CloseStatus[code=1009, reason=The decoded text message was too big for the output buffer and the endpoint does not support partial messages] in WebSocketClientSockJsSession[id='c5c680b9a75e488ba7bb129f90b700e6, url=ws://localhost.local:8084/admin/connect]**
2016-01-28 09:33:14.345 DEBUG 810 --- [lient-AsyncIO-1] o.s.m.simp.stomp.DefaultStompSession     : Connection closed session id=31d8ea85-ff24-ce54-c7cc-72352b88b493
2016-01-28 09:33:14.345  WARN 810 --- [lient-AsyncIO-1] l.e.c.w.CustomDefaultStompSessionHandler : Server disconnect
null
at org.apache.tomcat.websocket.WsFrameClient.access$100(WsFrameClient.java:31)
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:134)
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:108)
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
at sun.nio.ch.Invoker.invokeDirect(Invoker.java:157)
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.implRead(UnixAsynchronousSocketChannelImpl.java:553)
at sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:276)
at sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:297)
at java.nio.channels.AsynchronousSocketChannel.read(AsynchronousSocketChannel.java:420)
at org.apache.tomcat.websocket.AsyncChannelWrapperNonSecure.read(AsyncChannelWrapperNonSecure.java:52)
at org.apache.tomcat.websocket.WsFrameClient.processSocketRead(WsFrameClient.java:79)
at org.apache.tomcat.websocket.WsFrameClient.access$300(WsFrameClient.java:31)
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:125)
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:108)
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
at sun.nio.ch.Invoker$2.run(Invoker.java:218)
at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Unable to write the complete message as the WebSocket connection has been closed
at org.apache.tomcat.websocket.FutureToSendHandler.get(FutureToSendHandler.java:102)
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:275)
... 24 more
Caused by: java.io.IOException: Unable to write the complete message as the WebSocket connection has been closed
at org.apache.tomcat.websocket.WsSession.registerFuture(WsSession.java:658)
at org.apache.tomcat.websocket.FutureToSendHandler.get(FutureToSendHandler.java:92)
... 25 more
org.springframework.messaging.simp.stomp.ConnectionLostException: Connection closed
at org.springframework.messaging.simp.stomp.DefaultStompSession.afterConnectionClosed(DefaultStompSession.java:459)
at org.springframework.web.socket.messaging.WebSocketStompClient$WebSocketTcpConnectionHandlerAdapter.afterConnectionClosed(WebSocketStompClient.java:353)
at org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession.afterTransportClosed(AbstractClientSockJsSession.java:321)
at org.springframework.web.socket.sockjs.client.WebSocketTransport$ClientSockJsWebSocketHandler.afterConnectionClosed(WebSocketTransport.java:172)
at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.onClose(StandardWebSocketHandlerAdapter.java:141)
at org.apache.tomcat.websocket.WsSession.fireEndpointOnClose(WsSession.java:538)
at org.apache.tomcat.websocket.WsSession.doClose(WsSession.java:489)
at org.apache.tomcat.websocket.WsSession.close(WsSession.java:455)
at org.apache.tomcat.websocket.WsFrameClient.close(WsFrameClient.java:94)
at org.apache.tomcat.websocket.WsFrameClient.access$100(WsFrameClient.java:31)
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:134)
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:108)
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
at sun.nio.ch.Invoker.invokeDirect(Invoker.java:157)
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.implRead(UnixAsynchronousSocketChannelImpl.java:553)
at sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:276)
at sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:297)
at java.nio.channels.AsynchronousSocketChannel.read(AsynchronousSocketChannel.java:420)
at org.apache.tomcat.websocket.AsyncChannelWrapperNonSecure.read(AsyncChannelWrapperNonSecure.java:52)
at org.apache.tomcat.websocket.WsFrameClient.processSocketRead(WsFrameClient.java:79)
at org.apache.tomcat.websocket.WsFrameClient.access$300(WsFrameClient.java:31)
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:125)
at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:108)
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
at sun.nio.ch.Invoker$2.run(Invoker.java:218)
at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2016-01-28 09:33:14.346 DEBUG 810 --- [lient-AsyncIO-1] o.s.w.s.s.c.WebSocketClientSockJsSession : Closing session with CloseStatus[code=1000, reason=null] in WebSocketClientSockJsSession[id='c5c680b9a75e488ba7bb129f90b700e6, url=ws://localhost.local:8084/admin/connect]
2016-01-28 09:33:14.346 DEBUG 810 --- [lient-AsyncIO-1] o.s.w.s.s.c.WebSocketClientSockJsSession : Ignoring close (already closing or closed), current state=CLOSED
2个回答

5
你可以根据自己的需求更改最大文本缓冲区大小:
WebSocketContainer container = ContainerProvider.getWebSocketContainer();
container.setDefaultMaxTextMessageBufferSize(MAX_TEXT_MESSAGE_BUFFER_SIZE);
WebSocketClient wsClient = new StandardWebSocketClient(container);

3
在经过一周的苦思冥想后,我发现了问题所在。我使用的客户端(内部Spring Java WebSocket STOMP客户端)无法进行部分消息传递,也不能配置消息缓冲区的大小。解决方法(变通方法)是采用内部Java停止客户端代码,并实现自己的版本,该版本具有可配置的消息缓冲区大小以及实现处理部分消息的方式。希望这能帮助其他遇到这个问题的人。

2
你好 @jediknight562!如果您能分享您的代码,我将不胜感激!您可以通过askar.ibragimov@gmail.com发送或通过GitHub分享吗? - onkami

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接