相关疑难解决方法(0)

Stomp spring web socket消息超出大小限制

我正在我们的spring mvc web应用程序中实现spring web-socket.但是当我尝试向端点发送一个非常大的消息时,我遇到了超过大小限制的消息.

我收到以下错误,

message:The 'content-length' header 68718  exceeds the configured message buffer size limit 65536

14:49:11,506 ERROR [org.springframework.web.socket.messaging.StompSubProtocolHandler] (http-localhost/127.0.0.1:8080-4) Failed to parse TextMessage payload=[13684590},..], byteCount=16384, last=true] in session vlsxdeol. Sending STOMP ERROR to client.: org.springframework.messaging.simp.stomp.StompConversionException: The 'content-length' header 68718  exceeds the configured message buffer size limit 65536
at org.springframework.messaging.simp.stomp.BufferingStompDecoder.checkBufferLimits(BufferingStompDecoder.java:148) [spring-messaging-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.messaging.simp.stomp.BufferingStompDecoder.decode(BufferingStompDecoder.java:124) [spring-messaging-4.1.6.RELEASE.jar:4.1.6.RELEASE]
Run Code Online (Sandbox Code Playgroud)

这是我的配置

@MessageMapping("/user/sockettest" )
@SendTo("/topic/sockettestresult")
public String sockAdd(ListId[] listIds) {
..
SecurityContextHolder.getContext().getAuthentication().getPrincipal();

return stringRet;
}
Run Code Online (Sandbox Code Playgroud)

xml配置如下所示

<websocket:simple-broker prefix="/topic"/>

<websocket:message-converters register-defaults="false">
    <bean id="mappingJackson2MessageConverter" class="org.springframework.messaging.converter.MappingJackson2MessageConverter">
        <property name="objectMapper" ref="objectMapper"></property> …
Run Code Online (Sandbox Code Playgroud)

java stomp sockjs spring-websocket spring-web

7
推荐指数
2
解决办法
6885
查看次数

标签 统计

java ×1

sockjs ×1

spring-web ×1

spring-websocket ×1

stomp ×1