title: How client and server mapping message on Spring boot websocket
body: <p>I cloned a chat application project that uses spring boot websocket on github.
  Here is code:</p>
  
  <pre class="lang-java prettyprint-override"><code>@MessageMapping("/chat.private.{username}")
  public void filterPrivateMessage(@Payload ChatMessage message, @DestinationVariable("username") String username, Principal principal) {
  
      message.setUsername(principal.getName());
      simpMessagingTemplate.convertAndSend("/user/" + username + "/exchange/amq.direct/chat.message", message);
  }
  </code></pre>
  
  <p>Example: <strong>username</strong> variable is: <strong>foo@gmail.com</strong>, it mean the link to for client subscribe should be: <strong>/user/foo@gmail.com/exchange/amq.direct/chat.message</strong></p>
  
  <p>But in client code:</p>
  
  <pre class="lang-js prettyprint-override"><code>chatSocket = Stomp.over(new SockJS(url)); //use sockjs and stompjs
  chatSocket.subscribe("/user/exchange/amq.direct/chat.message"
  </code></pre>
  
  <p>I do not understand how to the application can send to correct client, when the client listen the different url (without foo@gmail.com).
  Can someone explain to me?</p>
  
  <p>Thanks.</p>