Package com.calclab.emite.core.events

Examples of com.calclab.emite.core.events.ConnectionStatusChangedEvent


    createBodyIfNeeded();
    currentBody.setAttribute("type", "terminate");
    sendBody(true);
    active = false;
    stream.sid = null;
    eventBus.fireEventFromSource(new ConnectionStatusChangedEvent(ConnectionStatus.disconnected, "logged out"), this);
  }
View Full Code Here


    final String type = response.getAttribute("type");
    // Openfire bug: terminal instead of terminate
    if ("terminate".equals(type) || "terminal".equals(type)) {
      stream.sid = null;
      active = false;
      eventBus.fireEventFromSource(new ConnectionStatusChangedEvent(ConnectionStatus.disconnected, "disconnected by server"), this);
    } else {
      if (stream.sid == null) {
        initStream(response);
        eventBus.fireEventFromSource(new ConnectionStatusChangedEvent(ConnectionStatus.connected), this);
      }
      shouldCollectResponses = true;
      for (final XMLPacket packet : response.getChildren()) {
        eventBus.fireEventFromSource(new PacketReceivedEvent(packet), this);
      }
View Full Code Here

          return;
       
        final int e = ++errors;
        logger.severe("Connection error #" + e + ": " + error.getMessage());
        if (e > RetryControl.maxRetries) {
          eventBus.fireEventFromSource(new ConnectionStatusChangedEvent(ConnectionStatus.error, "Connection error: " + error.toString()), this);
          disconnect();
        } else {
          final int scedTime = RetryControl.retry(e);
          eventBus.fireEventFromSource(new ConnectionStatusChangedEvent(ConnectionStatus.waitingForRetry, "The connection will try to re-connect in " + scedTime + " milliseconds.", scedTime), this);
          Platform.schedule(scedTime, new ScheduledAction() {
            @Override
            public void run() {
              logger.info("Error retry: " + e);
              send(request);
View Full Code Here

TOP

Related Classes of com.calclab.emite.core.events.ConnectionStatusChangedEvent

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.