SDK
SDK Java v1.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.

This SDK has been deprecated because of stability issues. It is not advised to use it in a production environment.

Events #

An event system allows to be notified when the SDK status changes. These events are issued by the Kuzzle SDK object.

Subscription to these events is possible by specifying callbacks that will be executed when a specific event is issued by the SDK instance.

These callbacks can be added by the method addListener.

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

Emitted Events #

connected #

Triggered when the SDK has successfully connected to Kuzzle.

discarded #

Triggered when Kuzzle rejects a request (e.g. request can't be parsed, request too large, ...).

Callback argument

A String representing a JSON object containing the following properties:

PropertyTypeDescription
messageStringError description
statusIntegerError code
stackStringStacktrace (development mode only)

disconnected #

Triggered when the current session has been unexpectedly disconnected.

loginAttempt #

Triggered when a login attempt completes, either with a success or a failure result.

Callback arguments

A String representing a JSON object containing the following properties:

PropertyTypeDescription
successbooleanIndicate if login attempt succeed
errorStringError message when login fail

networkError #

Triggered when the SDK has failed to connect to Kuzzle. This event does not trigger the offline mode.

Callback arguments

A String representing a JSON object containing the following properties:

PropertyTypeDescription
messageStringError description
statusIntegerError code
stackStringStacktrace (development mode only)

offlineQueuePop #

Triggered whenever a request is removed from the offline queue.

Callback arguments

A String representing a JSON object containing the request removed from the queue.

offlineQueuePush #

Triggered whenever a request is added to the offline queue.

Callback arguments

A String representing a JSON object containing the following properties:

PropertyTypeDescription
requestJSON objectThe request added to the queue

queryError #

Triggered whenever Kuzzle responds with an error

Callback arguments

A String representing a JSON object containing the following properties:

PropertyTypeDescription
requestJSON objectThe request that causing an error
errorJSON objectThe error details

reconnected #

Triggered when the current session has reconnected to Kuzzle after a disconnection, and only if autoReconnect is set to true.

tokenExpired #

Triggered when Kuzzle rejects a request because the authentication token has expired.