mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-20 17:03:13 +00:00
* fix: add stop methods to protocols to prevent event listener leaks * fix: add abort signal support for graceful store query cancellation * fix: call protocol stop methods in WakuNode.stop() * fix: improve QueryOnConnect cleanup and abort signal handling * fix: improve MissingMessageRetriever cleanup with abort signal * fix: add stopAllRetries method to RetryManager for proper cleanup * fix: implement comprehensive ReliableChannel stop() with proper cleanup * fix: add active query tracking to QueryOnConnect and await its stop() * fix: add stop() to IRelayAPI and IStore interfaces, implement in SDK wrappers * align with usual naming (isStarted) * remove unnecessary `await` * test: `stop()` is now async * chore: use more concise syntax --------- Co-authored-by: Levente Kiss <levente.kiss@solarpunk.buzz>
25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
import type { GossipSub } from "@chainsafe/libp2p-gossipsub";
|
|
import type { PeerIdStr, TopicStr } from "@chainsafe/libp2p-gossipsub/types";
|
|
|
|
import type { PubsubTopic } from "./misc.js";
|
|
import type { IReceiver } from "./receiver.js";
|
|
import type { ISender } from "./sender.js";
|
|
|
|
/**
|
|
* Interface representing the Relay API, providing control and information about the GossipSub protocol.
|
|
*
|
|
* @property gossipSub - The GossipSub instance used for managing pub/sub behavior.
|
|
* @property start - Function to start the relay, returning a Promise that resolves when initialization is complete.
|
|
* @property getMeshPeers - Function to retrieve the mesh peers for a given topic or all topics if none is specified. Returns an array of peer IDs as strings.
|
|
*/
|
|
export interface IRelayAPI {
|
|
readonly pubsubTopics: Set<PubsubTopic>;
|
|
readonly gossipSub: GossipSub;
|
|
start: () => Promise<void>;
|
|
stop: () => Promise<void>;
|
|
waitForPeers: () => Promise<void>;
|
|
getMeshPeers: (topic?: TopicStr) => PeerIdStr[];
|
|
}
|
|
|
|
export type IRelay = IRelayAPI & ISender & IReceiver;
|