Package nxt.http

Class EventWait


public class EventWait extends APIServlet.APIRequestHandler

The EventWait API will wait for one of the server events registered by EventRegister. EventWait will return immediately if one or more events have occurred since the last time EventWait was called. All pending events will be returned in a single response. The events remain registered so successive calls to EventWait can be made without another call to EventRegister.

Request parameters:

  • token - Event registration token returned by the EventRegister API.
  • timeout - Number of seconds to wait for an event. The EventWait will complete normally if no event is received within the timeout interval. nxt.apiEventTimeout will be used if no timeout value is specified or if the requested timeout is greater than nxt.apiEventTimeout.

Response parameters:

  • events - An array of event objects

Error Response parameters:

  • errorCode - API error code
  • errorDescription - API error description

Event object:

  • name - The event name
  • ids - An array of event object identifiers

Event names:

  • Block.BLOCK_GENERATED
  • Block.BLOCK_POPPED
  • Block.BLOCK_PUSHED
  • Ledger.ADD_ENTRY.account - Monitor changes to the specified account. 'account' may be the numeric identifier or the Reed-Solomon identifier of the account to monitor for updates. All accounts will be monitored if no account is specified. Specifying an account identifier of 0 is the same as not specifying an account.
  • Peer.ADD_ACTIVE_PEER
  • Peer.ADD_PEER
  • Peer.BLACKLIST
  • Peer.CHANGE_ACTIVE_PEER
  • Peer.CHANGE_ANNOUNCED_ADDRESS
  • Peer.CHANGE_SERVICES
  • Peer.REMOVE_PEER
  • Peer.UNBLACKLIST
  • Transaction.ADDED_CONFIRMED_TRANSACTIONS.account (omit account to monitor all accounts)
  • Transaction.ADDED_UNCONFIRMED_TRANSACTIONS.account (omit account to monitor all accounts)
  • Transaction.REJECT_PHASED_TRANSACTION.account (omit account to monitor all accounts)
  • Transaction.RELEASE_PHASED_TRANSACTION.account (omit account to monitor all accounts)
  • Transaction.REMOVED_UNCONFIRMED_TRANSACTIONS.account (omit account to monitor all accounts)

Event object identifiers:

  • Block string identifier for a Block event
  • Peer network address for a Peer event
  • Transaction chain and full hash for a Transaction event as a string in the format 'chain:hash'