mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-05 07:13:11 +00:00
24 lines
722 B
TypeScript
24 lines
722 B
TypeScript
import type { IDecodedMessage, IDecoder } from "./message.js";
|
|
import type {
|
|
ContentTopic,
|
|
IAsyncIterator,
|
|
PubSubTopic,
|
|
Unsubscribe,
|
|
} from "./misc.js";
|
|
import type { Callback, ProtocolOptions } from "./protocols.js";
|
|
|
|
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>;
|
|
getActiveSubscriptions: () => ActiveSubscriptions;
|
|
}
|