Node.js SDK
Index Network Client SDK
Index Network Node SDK to facilitates various operations on the protocol. In this example, we'll demonstrate how to authenticate, create an Index, and add an Item to it.
Index is a fundamental component of the Index Network, designed to facilitate context management and enable semantic interoperability within your system. It serves as a structured way to organize and store data related to specific contexts.
Item represents a graph node within an Index. It provides a standardized approach to representing and managing various types of data.
First, install the index-client via your preferred package manager:
Next, import it in your project:
Create an instance of IndexClient
:
For authentication, you need a DIDSession
. You can either sign in using a wallet or pass an existing session. Check Authentication for details explanation on how to initiate a session.
We're almost ready. Now, let's create an Index, with a title.
Great, now you have a truly decentralized index to interact with! Though it's empty, which means we need to create and add an Item
into it so we can interact. Let's do that.
Your index is now ready for interaction! To start a conversation and interact with the data, follow these steps:
The response should look something like this:
Listening Conversation Updates
Index Client SDK allows you to listen for updates to a conversation in real-time. This is useful for applications that need to react to new messages or changes in a conversation.
Here is an example of how you can use the listenToConversationUpdates
method to handle real-time updates in a conversation:
Last updated