Home > tupelo-wasm-sdk > CommunityMessenger
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
CommunityMessenger handles the overlay pubsub community provides to make sure that nodes correctly relay messages within this community. Community listends to a number of libp2p topics (we call shards here) and internal community topics are broadcast on those libp2p topics so that libp2p will correctly relay those messages.
Signature:
export declare class CommunityMessenger
Constructor | Modifiers | Description |
---|---|---|
(constructor)(name, shards, key, localIdentifier, pubsub) | (BETA) Constructs a new instance of the CommunityMessenger class |
Property | Modifiers | Type | Description |
---|---|---|---|
localIdentifier | Uint8Array |
(BETA) | |
name | string |
(BETA) |
Method | Modifiers | Description |
---|---|---|
publish(topic, payload) | (BETA) | |
subscribe(topic, subscriber) | (BETA) | |
unsubscribe(topic, subscriber) | (BETA) unsubscribe is the reverse of subscribe and works the same as libp2p pubsub works, you pass in a topic and the original subscription and your callback will no longer receive messages from that topic |