SDK
SDK Javascript v7.x

# Events

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

The API for interacting with events is described by our KuzzleEventEmitter class documentation.

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 discards a request, typically if no connection is established and the request is not queuable, either because the offline mode is not set or if set explicitely.

Callback arguments:

@param {object} request: the discarded request

# 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:

@param {object} data

Property Type Description
success
boolean
Indicate if login attempt succeed
error
string
Error message when login fail

# networkError

Triggered when the SDK has failed to connect to Kuzzle.

Callback arguments:

@param {Error} error

Property Type Description
message
string
Error description
status
number
Error code
stack
string
Stacktrace (development mode only)

# offlineQueuePop

Triggered whenever a request is removed from the offline queue.

Callback arguments:

@param {object} request: the request removed from the queue

# offlineQueuePush

Triggered whenever a request is added to the offline queue.

Callback arguments:

@param {object} data

Property Type Description
request
object
Request added to the queue

# queryError

Triggered whenever Kuzzle responds with an error

Callback arguments:

@param {KuzzleError} error - Error details @param {object} request - Request that caused the error

# 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.