title: How to send custom message to custom user with spring websocket?
body: <p>I'm new to <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#websocket" rel="noreferrer">spring websocket</a>. I want to send product changes to clients. For this, I want to do it as follows:
  Client creates a socket connection and subscribes destination:</p>
  
  <pre><code>var socket = new SockJS('/websocket');
  var stompClient = Stomp.over(socket);
  
  stompClient.connect({}, function (frame) {
      stompClient.subscribe('/product/changes', function (scoredata) {
          // We received product changes
      });
  });
  //Send Ajax request and say server I want to know product with id=5 changes.
  sendAjaxRequest(5);
  </code></pre>
  
  <p>I've configured spring app as follow:</p>
  
  <pre><code>@Configuration
  @EnableWebSocketMessageBroker
  public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
  
      @Override
      public void registerStompEndpoints(StompEndpointRegistry registry) {
          registry.addEndpoint("/websocket").withSockJS();
      }
  
      @Override
      public void configureMessageBroker(MessageBrokerRegistry registry) {
          registry.enableSimpleBroker("/product/");
          registry.setApplicationDestinationPrefixes("/app");
      }
  }
  </code></pre>
  
  <p>Now I need the following method:</p>
  
  <pre><code>@RestController
  public class ProductController {
  
      @GetMapping("product-{id}")
      public void startSubscribe(@PathVariable("id") Long id) {
  
          // register current websocket session with product id and 
          // then with convertAndSendToUser send changes to current user.
      }
  
  }
  </code></pre>
  
  <p>How do I to implement it?</p>