Package org.waveprotocol.box.webclient.client.atmosphere

Examples of org.waveprotocol.box.webclient.client.atmosphere.AtmosphereConnectionImpl


      final WaveSocket.WaveSocketCallback callback) {
    if (useWebSocketAlt) {
      return new WaveSocket() {

        private final AtmosphereConnection socket
        = new AtmosphereConnectionImpl(new AtmosphereConnectionListener() {

          @Override
          public void onConnect() {
            callback.onConnect();
          }

          @Override
          public void onDisconnect() {
            callback.onDisconnect();
          }

          @Override
          public void onMessage(String message) {
            callback.onMessage(message);
          }}, urlBase);

        @Override
        public void connect() {
          socket.connect();

        }

        @Override
        public void disconnect() {
          socket.close();
        }

        @Override
        public void sendMessage(String message) {
              socket.sendMessage(message);
        }

        };

    } else {
      return new WaveSocket() {
        final WebSocket socket = new WebSocket(new WebSocketCallback() {
          @Override
          public void onConnect() {
            callback.onConnect();
          }

          @Override
          public void onDisconnect() {
            callback.onDisconnect();
          }

          @Override
          public void onMessage(String message) {
            callback.onMessage(message);
          }
        });

        @Override
        public void connect() {
          socket.connect(urlBase + "socket");
        }

        @Override
        public void disconnect() {
          socket.close();
        }

        @Override
        public void sendMessage(String message) {
          socket.send(message);
        }
      };
    }
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.box.webclient.client.atmosphere.AtmosphereConnectionImpl

Copyright © 2018 www.massapicom. 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.