Search code examples
jakarta-eeglassfishwebsocketejbatmosphere

AtmosphereHandler is guaranteed to preserve the instance?


I'm using AtmosphereFramework's WebSockets, i've got a class annotated like this:

@WebSocketHandlerService(path = "/gts")
public class GameSocket extends WebSocketHandlerAdapter {

@Override void onOpen(WebSocket webSocket) {...}
@Override void onTextMessage(WebSocket webSocket, String message) throws IOException {...}

And i'd like to know if all calls (onOpen, onTextMessage, ...) from a SINGLE socket connection are guaranteed to use one and only one instance of GameSocket.

Else, i'm searching a way to keep user sessions into this JavaEE/Glassfish/EJB3 Websocket only environment.


Solution

  • (1) Yes, only one instance

    (2) There are some known issue with Session and GlassFish. Try it and if you see some issue, just come to the mailing list and I will describe how you can use the AtmosphereConfig.properties() to store state.

    (I am Atmosphere's creator).