tupelo-wasm-sdk

Home > tupelo-wasm-sdk > CommunityMessenger

CommunityMessenger class

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 

Constructors

Constructor Modifiers Description
(constructor)(name, shards, key, localIdentifier, pubsub)   (BETA) Constructs a new instance of the CommunityMessenger class

Properties

Property Modifiers Type Description
localIdentifier   Uint8Array (BETA)
name   string (BETA)

Methods

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