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 KuzzleEventHandler class documentation.

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

Emitted Events

QueueRecovered

Occurs when the offline queue of query has been successfuly recovered.

Handler Arguments

Copied to clipboard!
Handler();
Copied to clipboard!
kuzzle.EventHandler.QueueRecovered += () => {
  Console.WriteLine("Offline queue has successfully recovered.");
}

Reconnected

Occurs when the successfuly reconnects to the network.

Handler Arguments

Copied to clipboard!
Handler();
Copied to clipboard!
kuzzle.EventHandler.Reconnected += () => {
  Console.WriteLine("SDK successfully reconnects to Kuzzle");
}

TokenExpired

Occurs when the SDK sends a request and the current token has expired.

Handler Arguments

Copied to clipboard!
Handler();
Copied to clipboard!
kuzzle.EventHandler.TokenExpired += () => {
  Console.WriteLine("The current authentication token has expired");
}

UnhandledResponse

Occurs when an unhandled response is received.

Handler Arguments

Copied to clipboard!
Handler(KuzzleEventHandler sender, Response response);
Name Type Description
sender
KuzzleEventHandler
KuzzleEventHandler instance
response
Response
Unhandled Kuzzle API response
Copied to clipboard!
kuzzle.EventHandler.UnhandledResponse += (object sender, Response response) => {
  Console.WriteLine($"Unhandled response {response.ToString()}");
}

UserLoggedIn

Occurs when a user has logged in.

Handler Arguments

Copied to clipboard!
Handler(KuzzleEventHandler sender, UserLoggedInEvent user);
Name Type Description
sender
KuzzleEventHandler
KuzzleEventHandler instance
user
UserLoggedInEvent
Contains the kuid of the logged in user
Copied to clipboard!
kuzzle.EventHandler.UserLoggedIn += (object sender, UserLoggedInEvent user) => {
  Console.WriteLine($"User {user.Kuid} has logged in");
}

UserLoggedOut

Occurs when a user has logged out.

Handler Arguments

Copied to clipboard!
Handler();
Copied to clipboard!
kuzzle.EventHandler.UserLoggedOut += () => {
  Console.WriteLine("User has logged out");
}