title: Spring Boot WebSockets notifications
body: <p>In my Spring Boot application I'm trying to implement a notifications functionality based on WebSockets.</p>
  
  <p>I have provided a following configuration:</p>
  
  <pre><code>@Configuration
  @EnableWebSocketMessageBroker
  public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
  
      @Override
      public void registerStompEndpoints(StompEndpointRegistry registry) {
          registry.addEndpoint("/notifications").withSockJS();
      }
  
      @Override
      public void configureMessageBroker(MessageBrokerRegistry registry) {
          registry.enableSimpleBroker("/topic", "/queue");
      }
  
  }
  </code></pre>
  
  <p>and trying to use <code>SimpMessagingTemplate</code> in order to send a message from server side to a specific client(user).</p>
  
  <pre><code>@Autowired
  private SimpMessagingTemplate simpMessagingTemplate;
  
  public void sendMessages() {
      simpMessagingTemplate.convertAndSendToUser(%user%, "/horray", "Hello, World!");
  }
  </code></pre>
  
  <p>Right now I don't understand a few things:</p>
  
  <ol>
  <li><p>What value should be used for <code>%user%</code> parameter of
  <code>simpMessagingTemplate.convertAndSendToUser</code> method ?</p></li>
  <li><p>What is the correlation between my <code>/notifications</code> endpoint
  registered in <code>WebSocketConfig.registerStompEndpoints</code> method and
  <code>destination</code> parameter of
  <code>simpMessagingTemplate.convertAndSendToUser</code> method and how to properly use it? </p></li>
  <li><p>How to protect the users from reading other people's messages on the
  client ?</p></li>
  </ol>