Пример #1
0
 private JSONObject prepareSubscription() {
   subscriptions.pauseEventEmissions();
   subscriptions.addStream(SubscriptionManager.Stream.ledger);
   subscriptions.addStream(SubscriptionManager.Stream.server);
   subscriptions.unpauseEventEmissions();
   return subscriptions.allSubscribed();
 }
Пример #2
0
  public Account account(final AccountID id, IKeyPair keyPair) {
    if (accounts.containsKey(id)) {
      return accounts.get(id);
    } else {
      TrackedAccountRoot accountRoot = accountRoot(id);
      Account account =
          new Account(
              id, keyPair, accountRoot, new TransactionManager(this, accountRoot, id, keyPair));
      accounts.put(id, account);
      subscriptions.addAccount(id);

      return account;
    }
  }
Пример #3
0
  // Constructor
  public Client(WebSocketTransport ws) {
    this.ws = ws;
    ws.setHandler(this);

    prepareExecutor();
    // requires executor, so call after prepareExecutor
    scheduleMaintenance();

    subscriptions.on(
        SubscriptionManager.OnSubscribed.class,
        new SubscriptionManager.OnSubscribed() {
          @Override
          public void called(JSONObject subscription) {
            if (!connected) return;
            subscribe(subscription);
          }
        });
  }