INT-4360: Add ClientStompEncoder support
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
This commit is contained in:
committed by
Gary Russell
parent
2712e28074
commit
8766262399
@@ -433,3 +433,12 @@ Defaults to `false`.
|
||||
|
||||
|
||||
<13> See the same option on the `<int-websocket:outbound-channel-adapter>`.
|
||||
|
||||
[[client-stomp-encoder]]
|
||||
=== ClientStompEncoder
|
||||
|
||||
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.
|
||||
An instance of the `ClientStompEncoder` must be injected into the `StompSubProtocolHandler` for proper client side message preparation.
|
||||
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.
|
||||
If client doesn't send its messages in the proper `SEND` web socket frame, some STOMP brokers won't accept them.
|
||||
The purpose of the `ClientStompEncoder`, in this case, is to override `stompCommand` header to the `SEND` value before encoding the message to the `byte[]`.
|
||||
|
||||
Reference in New Issue
Block a user