I have, what I think to be, a very simple Spring WebSocket application. However, I\'m trying to use path variables for the subscription as well as the message mapping.
you can send a variable inside the path. for example i send "este/es/el/chat/java/" and obtaned in the server as "este:es:el:chat:java:"
client:
stompSession.send("/app/chat/este/es/el/chat/java/*", ...);
server:
@MessageMapping("/chat/**")
@SendToUser("/queue/reply")
public WebsocketData greeting(Message m,HelloMessage message,@Header("simpSessionId") String sessionId) throws Exception {
Map> nativeHeaders = (Map>) m.getHeaders().get("nativeHeaders");
String value= nativeHeaders.get("destination").getFirst().replaceAll("/app/chat/","").replaceAll("/",":");