title: How Server Sent Event send response to a specific client
body: <p>In Server Sent Event, it always send the same response to all the client. but what i want to know is, How to send response to an only one client using java.</p>
  
  <p>this is my event which define inside sw.js (SSE)</p>
  
  <pre><code>var eventSource = new EventSource("HelloServlet");
  eventSource.addEventListener('up_vote',function(event){
      console.log("data from s" , event.data);
      var title = event.data;
      self.registration.showNotification(title, {
            'body': event.data,
            'icon': 'images/icon.png'
          })
  });
  </code></pre>
  
  <p>I want to show this notification only to an specific user. not for everyboday. HelloServlet is my servlet and it contain this,</p>
  
  <pre><code>response.setContentType("text/event-stream");   
          response.setCharacterEncoding("UTF-8");
          PrintWriter writer = response.getWriter();
          String upVote = "u";
          String downVote = "d";
          for(int i=0; i&lt;10; i++) {
              writer.write("event:up_vote\n");
              writer.write("data: "+ upVote +"\n\n");
              writer.write("event:down_vote\n");
              writer.write("data: "+ downVote +"\n\n");
              writer.flush();
              try {
                  Thread.sleep(1000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
          }
          writer.close();
  </code></pre>