You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `StompSubProtocolHandler` explicitly sets `stompCommand` header
to the `MESSAGE` value ignoring any client inputs.
In this case the message is treated as from the server and ignored on
the STOMP Broker side from the client session.
* Introduce `ClientStompEncoder` for the client side to be injected
into the `StompSubProtocolHandler` for the proper client side messages
encoding/decoding.
Override `stompCommand` header to the `SEND` value if it is `MESSAGE`
before encoding to the `byte[]` to send to the session
JIRA: https://jira.spring.io/browse/INT-4360
**Cherry-pick to 4.3.x**
Fix WebSocket test to rely on the proper client config class
and don't pick up the server config unconditionally in the test context
Conflicts:
spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java
Resolved.
Copy file name to clipboardExpand all lines: spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java
Copy file name to clipboardExpand all lines: spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/WebSocketClientTests.java
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2014 the original author or authors.
2
+
* Copyright 2014-2017 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
Copy file name to clipboardExpand all lines: spring-integration-websocket/src/test/java/org/springframework/integration/websocket/server/WebSocketServerTests.java
Copy file name to clipboardExpand all lines: src/reference/asciidoc/web-sockets.adoc
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -433,3 +433,12 @@ Defaults to `false`.
433
433
434
434
435
435
<13> See the same option on the `<int-websocket:outbound-channel-adapter>`.
436
+
437
+
[[client-stomp-encoder]]
438
+
=== ClientStompEncoder
439
+
440
+
Starting with _version 4.3.13_, the `ClientStompEncoder` is provided as an extension of standard `StompEncoder` for using on client side of the WebSocket Channel Adapters.
441
+
An instance of the `ClientStompEncoder` must be injected into the `StompSubProtocolHandler` for proper client side message preparation.
442
+
One of the problem of the default `StompSubProtocolHandler` that it was designed for the server side, so it updates the `SEND` `stompCommand` header into `MESSAGE` as it must be by the STOMP protocol from server side.
443
+
If client doesn't send its messages in the proper `SEND` web socket frame, some STOMP brokers won't accept them.
444
+
The purpose of the `ClientStompEncoder`, in this case, is to override `stompCommand` header to the `SEND` value before encoding the message to the `byte[]`.
0 commit comments