Verida Documentation
  • Welcome
  • Network Overview
  • Start Building
  • Verida Wallet
  • Whitepapers
  • Glossary
  • Protocol
    • Core concepts
      • Design Principles
      • Decentralized Identity
      • Confidential Databases
      • Confidential Compute
      • Accounts and Identity
      • Data Storage
      • Application Contexts
      • Messaging
      • Schemas
      • Data Sharing
    • Client SDK
      • Getting Started
      • How It Works
      • Authentication
      • Data
      • Queries
      • Permissions
      • Messaging
      • Account Profiles
      • Events
      • Command Line Tools
      • Configuration
      • React Native
      • Advanced
    • Verida Connect SDK
      • Getting Started
      • WebUser
      • WalletConnect Support
      • Authentication Server
    • Blockchain Bridge
    • Run a Node
      • Database Node
        • Setup
        • Operations
        • FAQ
      • Compute Node
    • Verida Networks
  • Extensions
    • Credentials
      • Verifiable Credentials Developer SDK
      • cheqd Credential Service
      • Privado ID (fmr Polygon ID)
      • zkPass credentials
      • Reclaim Protocol credential
    • Verida URIs
    • Vue Components
Powered by GitBook
On this page
  • Data changes​
  • Inbox messages​
  • Database sync changes​

Was this helpful?

  1. Protocol
  2. Client SDK

Events

PreviousAccount ProfilesNextCommand Line Tools

Last updated 8 months ago

Was this helpful?

Your application can listen to events for when data changes in your application.

Data changes

Once a datastore or database is opened, you can listen to changes to automatically update your application:

const filter = {
    status: 'active'
}

const listener = await database.changes(function(row) {
  console.log("Row changed", row)
}, filter)

Try this out with your own profile data in the browser in our .

Options:

  • filter: An optional JSON object. The listener will only raise events if the data in the object matches the supplied filter.

You can cancel the event listener:

listener.cancel()

Similarly you can call:

const listener = await datastore.changes(function(row) { ... })

Inbox messages

You can be notified when a new inbox message arrives for your application:

const messaging = await context.getMessaging()
messaging.onMessage(function(message) { console.log('New message!', message)})

Data is automatically synchronized from remote encrypted servers to the local client. It’s possible to listen to events related to this syncing behavior:

const listener = database.onSync('error', (err) => { console.log(err) })
listener.cancel()

Database sync changes

A full list of events is available via the

​
tutorial
​
​
PouchDB Documentation