WebSocket 协议的简单 Java 实现 - websockets4j

fmms 12年前

websockets4j 是 WebSocket 协议的简单 Java 实现,当前支持该协议的草案 75和 76,未来将支持 TLS。

 @WebListener   public class WebappListener implements Serializable, ServletContextListener {          @Inject      private Server server;        private static final Logger log = Logger.getLogger(WebappListener.class.getName());        @Override      public void contextInitialized(ServletContextEvent sce) {          if (!server.isStarted()) {             server.start();             server.registerListener("/context",<i>some class implementing {@link WebScoketListner}</i>);             log.log(Level.INFO, "Started WebSocketServer");         }      }        @Override      public void contextDestroyed(ServletContextEvent sce) {              server.stop();              log.log(Level.INFO, "Stopped WebSocketServer");      }  }

项目主页:http://www.open-open.com/lib/view/home/1335966824812