Skip to content

Instantly share code, notes, and snippets.

@incepttechnologies
Created October 18, 2013 21:26
Show Gist options
  • Save incepttechnologies/7048509 to your computer and use it in GitHub Desktop.
Save incepttechnologies/7048509 to your computer and use it in GitHub Desktop.
server websocket end point
@ServerEndpoint(value = "/notification")
public class NotificationEndPoint implements Serializable {
/**
* Message receiver method
*
* @param message
* @return
*/
@OnMessage
public void messageReceiver(String message) {
System.out.println("Received message:" + message);
}
@OnOpen
public void onOpen(Session session) {
System.out.println("onOpen: " + session.getId());
sessions.add(session);
System.out.println("onOpen: Notification list size: " + sessions.size());
}
@OnClose
public void onClose(Session session) {
System.out.println("onClose: " + session.getId());
sessions.remove(session);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment