Making Notifications
To enable complex and real-time application use cases, Klave leverages full duplex connection provided by WebSocket. 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:
Class | Operation | Parameters | Returns | Behavior |
---|---|---|---|---|
Notifier | sendJson | message | - | Notify the json object passed as parameter |
Notifier | sendString | message | - | Notify the string passed as parameter |
Notifier | sendArrayBuffer | message | - | 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: