title: How to use WebSockets broadcast for play framework 1.2.7
body: <p>My code can work.But only refresh a page of one window.<br>
  If I open window1 and window2 , both open websocket connect. <br>
  I keyin word "test123" in window1, click sendbutton.<br>
  Only refresh window1.<br>
  How to refresh window1 and window2 ?<br>
  Client</p>
  
  <pre><code>&lt;script&gt;
  window.onload = function() {
      document.getElementById('sendbutton').addEventListener('click', sendMessage,false);
      document.getElementById('connectbutton').addEventListener('click', connect, false);        
  }
  
  function writeStatus(message) {
      var html = document.createElement("div");
      html.setAttribute('class', 'message');
      html.innerHTML = message;
      document.getElementById("status").appendChild(html);
  }
  function connect() {
      ws = new WebSocket("ws://localhost:9000/ws?name=test");
      ws.onopen = function(evt) { 
          writeStatus("connected");
      }        
      ws.onmessage = function(evt) {
          writeStatus("response: " + evt.data);
      }        
  }
  
  function sendMessage() {
      ws.send(document.getElementById('messagefield').value);
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;    
  &lt;button id="connectbutton"&gt;Connect&lt;/button&gt;    
  &lt;input type="text" id="messagefield"/&gt;
  &lt;button id="sendbutton"&gt;Send&lt;/button&gt;
  &lt;div id="status"&gt;&lt;/div&gt;   
  &lt;/body&gt;
  </code></pre>
  
  <p>Play Framework WebSocketController</p>
  
  <pre><code>public class WebSocket extends WebSocketController {
  public static void test(String name) {
  
      while(inbound.isOpen()) {
          WebSocketEvent evt = await(inbound.nextEvent());
          if(evt instanceof WebSocketFrame) {
              WebSocketFrame frame = (WebSocketFrame)evt;
              System.out.println("received: " + frame.getTextData());
              if(!frame.isBinary()) {
                  if(frame.getTextData().equals("quit")) {
                      outbound.send("Bye!");
                      disconnect();
                  } else {
                          outbound.send("Echo: %s", frame.getTextData());
                      }
                  }
              } 
          }
       }
   }
  </code></pre>