title: Server Sent Events don't work in Play Framework
body: <p>The following codes don't work in Play framework 2.3</p>
  
  <p>controllers.NotificationHandler.sendNotification():</p>
  
  <pre><code> def sendNotification = Action {
      request =&gt;
        val currentdate = new java.util.Date()
        Ok("data: " + currentdate.toString())
          .as( "text/event-stream")
          .withHeaders("Content-Type"-&gt;"text/event-stream")
          .withHeaders("Cache-Control"-&gt;"no-cache")
          .withHeaders("Connection"-&gt;"keep-alive")
   }
  </code></pre>
  
  <p>The JS code:</p>
  
  <pre><code>var event = new EventSource("@controllers.NotificationHandler.sendNotification()");
  event.addEventListener('message', function( event ) {
      alert(event.data);
  } );
  </code></pre>