SDK
SDK C# v2.x
2

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 #

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

Reconnected #

Occurs when the successfuly reconnects to the network.

Handler Arguments #

Handler();
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 #

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

UnhandledResponse #

Occurs when an unhandled response is received.

Handler Arguments #

Handler(KuzzleEventHandler sender, Response response);
NameTypeDescription
sender
KuzzleEventHandler
KuzzleEventHandler instance
response
Response
Unhandled Kuzzle API response
kuzzle.EventHandler.UnhandledResponse += (object sender, Response response) => {
  Console.WriteLine($"Unhandled response {response.ToString()}");
}

UserLoggedIn #

Occurs when a user has logged in.

Handler Arguments #

Handler(KuzzleEventHandler sender, UserLoggedInEvent user);
NameTypeDescription
sender
KuzzleEventHandler
KuzzleEventHandler instance
user
UserLoggedInEvent
Contains the kuid of the logged in user
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 #

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