Examples of AtmosphereChannel


Examples of org.waveprotocol.box.server.rpc.atmosphere.AtmosphereChannel

    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

      if (resource.getRequest().getMethod().equalsIgnoreCase("GET")) {

        resource.suspend();

      }


      if (resource.getRequest().getMethod().equalsIgnoreCase("POST")) {

        StringBuilder b = IOUtils.readEntirely(resource);
        resourceChannel.onMessage(b.toString());

      }

    }
View Full Code Here

Examples of org.waveprotocol.box.server.rpc.atmosphere.AtmosphereChannel

        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

Examples of org.waveprotocol.box.server.rpc.atmosphere.AtmosphereChannel

    private final AtmosphereChannel atmosphereChannel;

    public AtmosphereConnection(ParticipantId loggedInUser, ServerRpcProvider provider) {
      super(loggedInUser, provider);

      atmosphereChannel = new AtmosphereChannel(this);
      expectMessages(atmosphereChannel);

    }
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.