mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-13 05:23:13 +00:00
* chore: update noise * update: package.lock * update: @chainsafe/libp2p-gossipsub * rm unwanted libp2p interface deps & bump up libp2p * refactor code for new deps * update: new package.lock * setup prettier, refactor eslint and rm trailing commas * update package.lock * fix build * import type for interface * fix imports for merge * update typedoc exports * add: CustomEvent import * use new libp2p interface * add aegir as dev dep for tests
20 lines
675 B
TypeScript
20 lines
675 B
TypeScript
import type { IDecodedMessage, IDecoder } from "./message.js";
|
|
import type { IAsyncIterator, PubSubTopic, Unsubscribe } from "./misc.js";
|
|
import type { Callback, ProtocolOptions } from "./protocols.js";
|
|
|
|
type ContentTopic = string;
|
|
|
|
export type ActiveSubscriptions = Map<PubSubTopic, ContentTopic[]>;
|
|
|
|
export interface IReceiver {
|
|
toSubscriptionIterator: <T extends IDecodedMessage>(
|
|
decoders: IDecoder<T> | IDecoder<T>[],
|
|
opts?: ProtocolOptions
|
|
) => Promise<IAsyncIterator<T>>;
|
|
subscribe: <T extends IDecodedMessage>(
|
|
decoders: IDecoder<T> | IDecoder<T>[],
|
|
callback: Callback<T>,
|
|
opts?: ProtocolOptions
|
|
) => Unsubscribe | Promise<Unsubscribe>;
|
|
}
|