Is there any way to obtain STOMP client IP address? I am intercepting inbound channel but I cannot see any way to check the ip address.
Any help appreciated.
Tried to add this information as a comment, but stackoverflow complains that it is too long for the comment, so I post it as answer to
It is possible to get this attribute in service without passing SimpMessageHeaderAccessor ? I mean something similiar to injecting HttpServletRequest – shark Nov 23 '15 at 15:02
question.
I was able to achieve "close" results with such syntax:
@MessageMapping("/destination")
@SendTo("/topic/someTopic")
public String send(@Header("simpSessionAttributes") Map sessionAttributes) {
String clientsAddress = sessionAttributes.get("ip"));
return "The sender's address is: " + clientsAddress ;
}
I am not familiar to the origin of the "simpSessionAttributes" name of the header of the message, but I noticed that if I put the information in a way it is described in this thread by the @Sergi Almar - I get such result. But perhaps this name "simpSessionAttributes" may depend on some environment configuration or particular implementation of the message framework idk...
Also I do not mind to include this detalization as a part of the answer of the @Sergi Almar.