Examples of AtmosphereResourceSession


Examples of org.atmosphere.cpr.AtmosphereResourceSession


    @Override
    public void onRequest(AtmosphereResource resource) throws IOException {

      AtmosphereResourceSession resourceSession =
          AtmosphereResourceSessionFactory.getDefault().getSession(resource);

      AtmosphereChannel resourceChannel =
          resourceSession.getAttribute(WAVE_CHANNEL_ATTRIBUTE, AtmosphereChannel.class);

      if (resourceChannel == null) {

        ParticipantId loggedInUser =
            provider.sessionManager.getLoggedInUser(resource.getRequest().getSession(false));

        AtmosphereConnection connection = new AtmosphereConnection(loggedInUser, provider);
        resourceChannel = connection.getAtmosphereChannel();
        resourceSession.setAttribute(WAVE_CHANNEL_ATTRIBUTE, resourceChannel);
        resourceChannel.onConnect(resource);
      }

      resource.setBroadcaster(resourceChannel.getBroadcaster()); // on every
                                                                 // request
View Full Code Here

Examples of org.atmosphere.cpr.AtmosphereResourceSession

      } else if (event.isClosedByApplication() || event.isClosedByClient()) {

        LOG.fine("CONNECTION CLOSED");

        AtmosphereResourceSession resourceSession =
            AtmosphereResourceSessionFactory.getDefault().getSession(resource);

        AtmosphereChannel resourceChannel =
            resourceSession.getAttribute(WAVE_CHANNEL_ATTRIBUTE, AtmosphereChannel.class);

        if (resourceChannel != null) {
          resourceChannel.onDisconnect();
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.