public class EventRegister extends APIServlet.APIRequestHandler
The EventRegister API will create an event listener and register one or more server events. The 'add' and 'remove' parameters must be omitted or must both be false in order to create a new event listener.
After calling EventRegister, the application needs to call the EventWait API to wait for one of the registered events to occur. The events will remain registered so successive calls to EventWait can be made without another call to EventRegister.
When the event listener is no longer needed, the application should call EventRegister with an empty event list and 'remove=true'. An outstanding event wait will be completed and the event listener will be canceled.
An existing event list can be modified by calling EventRegister with either 'add=true' or 'remove=true'. The current event list will be replaced if both parameters are omitted or are false.
Event registration will be canceled if the application does not issue an EventWait before the time interval specified by nxt.apiEventTimeout expires. The timer is reset each time an EventWait is processed.
An application cannot register events if the maximum number of event users specified by nxt.apiMaxEventUsers has been reached.
Request parameters:
Response parameters:
Error Response parameters:
Event names:
DESCRIPTION_FIELD, MESSAGE_FIELD, NAME_FIELD
Modifier and Type | Method and Description |
---|---|
protected boolean |
allowRequiredBlockParameters()
No required block parameters
|
protected org.json.simple.JSONStreamAware |
processRequest(javax.servlet.http.HttpServletRequest req)
Process the EventRegister API request
|
protected boolean |
requirePost() |
getAPITags, getFileParameter, getParameters, processRequest, requireBlockchain, requireFullClient, requirePassword, startDbTransaction
protected org.json.simple.JSONStreamAware processRequest(javax.servlet.http.HttpServletRequest req)
processRequest
in class APIServlet.APIRequestHandler
req
- API requestprotected final boolean requirePost()
requirePost
in class APIServlet.APIRequestHandler
protected boolean allowRequiredBlockParameters()
allowRequiredBlockParameters
in class APIServlet.APIRequestHandler