Enclave SDK

Making Notifications

To enable complex and real-time application use cases, Klave leverages full duplex connection provided by WebSocket (opens in a new tab). This means that you can send real-time notifications from within your transaction and query function.

Using Notification from Applications

Sending back notifications is the only way to return any payload from your transaction and query business logic. Klave SDK provides a simple interface to create and send notifications.

The available set of operations is the following one:

NotifiersendJsonmessage-Notify the json object passed as parameter
NotifiersendStringmessage-Notify the string passed as parameter
NotifiersendArrayBuffermessage-Notify the ArrayBuffer passed as parameter

In AssemblyScipt, the notification manager can be accessed through the Notifier keyword. Notifications can be used within query or transaction context. For example:

import { Notifier } from '@klave/sdk';
export class StoreInput {
    key!: string;
    value!: string;
export class FetchOutput {
    success!: boolean;
    value!: string;
 * @query
export function notifyExample(input: StoreInput): void {
    //Returning the input back
    //Returning a json back
            success: true,
    //Returning a string back
    Notifier.sendString("Notify me!"); ;