SDK
SDK Java v2.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

Events #

The Kuzzle instance periodically emits named events that provide useful updates about the state of the Kuzzle client. To subscribe to these events, use the addListener function and specify the event name and the callback function that will be executed when the event is emitted. To unsubscribe to an event, use the removeListener function, specifying the name of the event to remove.


Emitted Events #

Event NameCallback argumentsDescription
connected(none)Triggered when the SDK has successfully connected to Kuzzle
discardederror (object)Triggered when Kuzzle rejects a request (e.g. request can't be parsed, request too large, ...)
disconnected(none)Triggered when the current session has been unexpectedly disconnected
loginAttempt{ "success": <boolean>, "error": "<error message>" }Triggered when a login attempt completes, either with a success or a failure result
networkErrorerror (object)Triggered when the SDK has failed to connect to Kuzzle. Does not trigger offline mode.
offlineQueuePopquery (object)Triggered whenever a request is removed from the offline queue.
offlineQueuePush{ "query": <object>, "cb": <function> }Triggered whenever a request is added to the offline queue
queryErrorerror (object), query (object)Triggered whenever Kuzzle responds with an error
reconnected(none)Triggered when the current session has reconnected to Kuzzle after a disconnection, and only if autoReconnect is set to true
tokenExpired(none)Triggered when Kuzzle rejected a request because the authentication token expired

Note: listeners are called in the order of their insertion.