Working with Threads
Threads allow users to communicate using topic-specific communication channels.
Each Context can contain any number of Threads with a unique identifier (threadId) used to distinguish them.
Threads do not need to have unique names or assigned public keys.
Permissions
Threads differentiate two types of users - Managers and Regular Users. The table below shows the differences in their permissions:
| Activity | User | Manager |
|---|---|---|
| Sending messages | yes | yes |
| Editing Thread | no | yes |
| Deleting messages | only their own | all messages |
The values above are the default policy values defined by PrivMX. To read more about Policies and learn how to modify them, go to Policies.
Working with Threads
Before working with Threads, follow the Getting Started Guide. It will show you how to set up your project to work with PrivMX Bridge. Sample code on this page is based on the initial assumptions
When working with Threads, you will use the following:
ThreadApi- provides methods used to manage Threads in given Context
Creating Threads
Creating a basic, unnamed Thread, which can act as an encrypted data container:
Fetching Threads
Fetching the most recent Threads in given Context:
As a result you will receive an object:
A detailed description of the Thread object fields can be found in API Reference.
Modifying Threads
To update a Thread you must always provide a full list of parameters.
The updateThread(...) method needs all the parameters as in the createThread(...) method and a few more. If you want to update one of the parameters - provide it in a new modified form. If - on the other hand - you want to leave the parameter unchanged, provide it as it was before. All current values of the parameters of a given Thread can be obtained using getThread(threadId)
We use cookies on our website. We use them to ensure proper functioning of the site and, if you agree, for purposes such as analytics, marketing, and targeting ads.