title: Websocket send data all client in playframework 2
body: <p>i need help to understand WS in playframework</p>
  
  <p>i have the next code in my controller</p>
  
  <pre><code>public static WebSocket&lt;String&gt; sockHandler() {
  return new WebSocket&lt;String&gt;() {
      // Se llama para establecer el WS
  
      public void onReady(WebSocket.In&lt;String&gt; in, WebSocket.Out&lt;String&gt; out) {
  
          //por cada evento recivido por el socket
          // Se regitra una llamada para el procesamiento de los eventos
          in.onMessage(new Callback&lt;String&gt;() {
              public void invoke(String event) {
                  //Logger.info(event)
                  System.out.println("este es el event "+event);
  
              } 
           });
  
          // write out a greeting
          out.write("Hola a todos");
      }
  };
  </code></pre>
  
  <p>}</p>
  
  <p>in my view, i have:</p>
  
  <pre><code>&lt;script type="text/javascript" charset="utf-8"&gt;
  
      $(function() {
          var WS = window['MozWebSocket'] ? MozWebSocket : WebSocket
          var sock = new WS("@routes.Application.sockHandler().webSocketURL(request)")
  
          $('button.send').click(function() {
            console.log('entro al click');
            sendMessage();  
          }); 
  
          var sendMessage = function() {
              sock.send("llamando controller");
          }
  
          var receiveEvent= function(event) {
              $('.greeting').append(event.data);
              alert('entro');
          }
  
          sock.onmessage=receiveEvent;
      })
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I need to always print the alert('entro') on all clients when a client sends an action.</p>
  
  <p>Excuse my English, but I speak Spanish.</p>
  
  <p>thank you very much</p>