Created
February 14, 2017 03:39
-
-
Save abhirockzz/d7daf85ba1a746e3001f2dc381a0975b to your computer and use it in GitHub Desktop.
Stateful EJB In WebSocket (1/2)
This file contains 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
@Stateful | |
public class ClientChatState { | |
//...who needs details ! | |
} | |
@ServerEndpoint("/letschat/{login-id}") | |
public class ChatEndpoint { | |
@EJB | |
private ClientChatState ccs; //stateful EJB | |
private String userID; | |
@OnOpen | |
public void connOpened(@PathParam("login-id") String loginID, Session session) { | |
ccs.setUser(loginID) | |
.currentState(State.JOINED); //everyone likes a fluent API! | |
} | |
.... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment