Created
October 18, 2013 21:26
-
-
Save incepttechnologies/7048509 to your computer and use it in GitHub Desktop.
server websocket end point
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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