SHARE
TWEET

HolaTodosEndPoint.java

apuntesdejava May 22nd, 2013 6,516 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top