Esempio n. 1
0
  private void notifyConnected() {
    pingTimeout.cancel();
    retries = 0;

    if (!connected) {
      connected = true;
      connectedTime = System.currentTimeMillis();
      LogUtil.log(this + ": SSE channel is active.");
    }

    if (clientMessageBus.getState() == BusState.CONNECTION_INTERRUPTED) {
      clientMessageBus.setState(BusState.CONNECTED);
    }
  }
Esempio n. 2
0
  @Override
  public void configure(final Message capabilitiesMessage) {
    configured = true;

    if (!isSSESupported()) {
      hosed = true;
      unsupportedReason = UNSUPPORTED_MESSAGE_NO_SERVER_SUPPORT;
      LogUtil.log("this browser does not support SSE");
      return;
    }

    this.sseEntryPoint =
        URL.encode(
                clientMessageBus.getApplicationLocation(clientMessageBus.getInServiceEntryPoint()))
            + "?z=0000&sse=1&clientId="
            + URL.encodePathSegment(clientMessageBus.getClientId());
  }
Esempio n. 3
0
  private void notifyDisconnected() {
    connected = false;

    pingTimeout.cancel();
    LogUtil.log(this + " channel disconnected.");
    connectedTime = -1;
    clientMessageBus.setState(BusState.CONNECTION_INTERRUPTED);

    disconnect(sseChannel);

    if (!stopped) {
      retries++;
      start();
    }
  }
Esempio n. 4
0
  public SSEHandler(
      final MessageCallback messageCallback, final ClientMessageBusImpl clientMessageBus) {
    this.clientMessageBus = clientMessageBus;
    this.messageCallback = messageCallback;
    this.pollingHandler =
        HttpPollingHandler.newNoPollingInstance(messageCallback, clientMessageBus);

    sseAgentSubscription =
        clientMessageBus.subscribe(
            SSE_AGENT_SERVICE,
            new MessageCallback() {
              @Override
              public void callback(final Message message) {
                notifyConnected();
              }
            });
  }
Esempio n. 5
0
 @Override
 public String getTxEndpoint() {
   return clientMessageBus.getOutServiceEntryPoint();
 }