I have a basic spring websocket application which currently sends basic data to subscribers.
Currently the system uses the SimpMessageSendingOperations
class as the message handler.
If I call SimpMessageSendingOperations.convertAndSend(destination, object)
then the object is converted and received by the subscribed clients.
I would like to be able to send a custom header to the clients.
I have tried using the SimpMessageSendingOperations.convertAndSend(destination, object, headers)
method to do this. However the custom header is not included in the stomp message.
Debugging through the code it looks like StompHeaderAccessor.toStompHeaderMap()
method calls
toNativeHeaderMap()
which uses the native header and the original native header maps to build up the stomp headers.
Is there a way to get a custom header added to stomp message?