@@ -0,0 +1,1344 @@
+package org.realityforge.gwt.websockets.example.server;%0A%0Aimport java.util.Collections;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0Aimport java.util.logging.Logger;%0Aimport javax.websocket.OnClose;%0Aimport javax.websocket.OnMessage;%0Aimport javax.websocket.OnOpen;%0Aimport javax.websocket.Session;%0Aimport javax.websocket.server.ServerEndpoint;%0A%0A@ServerEndpoint( %22/chat%22 )%0Apublic class ChatServer%0A%7B%0A  private static final Logger LOG = Logger.getLogger( ChatServer.class.getName() );%0A%0A  private static Set%3CSession%3E peers = Collections.synchronizedSet( new HashSet%3CSession%3E() );%0A%0A  @OnOpen%0A  public void onOpen( final Session session )%0A  %7B%0A    LOG.info( %22onOpen(%22 + session.getId() + %22)%22 );%0A    peers.add( session );%0A  %7D%0A%0A  @OnClose%0A  public void onClose( final Session session )%0A  %7B%0A    LOG.info( %22onClose(%22 + session.getId() + %22)%22 );%0A    peers.remove( session );%0A  %7D%0A%0A  @OnMessage%0A  public void onMessage( final String message, final Session session )%0A  %7B%0A    LOG.info( %22onClose(%22 + message + %22,%22 + session.getId() + %22)%22 );%0A    final String id = session.getId();%0A    for ( final Session peer : peers )%0A    %7B%0A      if ( peer.getId().equals( session.getId() ) )%0A      %7B%0A        peer.getAsyncRemote().sendText( %22You said %22 + message );%0A      %7D%0A      else%0A      %7B%0A        peer.getAsyncRemote().sendText( id + %22 says %22 + message );%0A      %7D%0A    %7D%0A  %7D%0A%7D

Add server-side chate component