Retrieving the original AtmosphereResource with WebSocket - Atmosphere/atmosphere GitHub Wiki

This content has been merged into Understanding AtmosphereResource

To support WebSocket the same way as other transport, Atmosphere, by default, creates an AtmosphereResource for the handshake operation, and new AtmosphereResource every time a new websocket message is received. In case your application needs to retrieve the original one, e.g the one used for the handshake, just using the following attribute from any AtmosphereRequest:

   String uuid = (String) request
        .getAttribute(ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID);
   AtmosphereResource resource = atmosphereResourceFactory.find(uuid);