document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package com.apuntesdejava.websocket;
  2.  
  3. import java.util.logging.Logger;
  4. import javax.websocket.OnClose;
  5. import javax.websocket.OnMessage;
  6. import javax.websocket.OnOpen;
  7. import javax.websocket.server.ServerEndpoint;
  8.  
  9. @ServerEndpoint("/holaTodos")
  10. public class HolaTodosEndPoint {
  11.  
  12.     static final Logger LOGGER = Logger.getLogger(HolaTodosEndPoint.class.getName());
  13.  
  14.     @OnOpen
  15.     public void iniciaConexion() {
  16.         LOGGER.info("Iniciando la conexion");
  17.  
  18.     }
  19.  
  20.     @OnClose
  21.     public void finConexion() {
  22.         LOGGER.info("Terminando la conexion");
  23.  
  24.     }
  25.  
  26.     @OnMessage
  27.     public String onMessage(String mensaje) {
  28.         LOGGER.log(Level.INFO, "Recibiendo mensaje:{0}", mensaje);
  29.         return "Hola a todos con este mensaje:" + mensaje;
  30.     }
  31.  
  32. }
');