2023-03-31 03:17:41 +02:00
|
|
|
import type { IDecodedMessage, IDecoder } from "./message.js";
|
2025-07-02 12:37:54 +02:00
|
|
|
import type { IAsyncIterator, Unsubscribe } from "./misc.js";
|
2023-09-07 13:15:49 +05:30
|
|
|
import type { Callback } from "./protocols.js";
|
2023-03-31 03:17:41 +02:00
|
|
|
|
2025-07-02 12:37:54 +02:00
|
|
|
/**
|
|
|
|
|
* @deprecated will be replaced in next version
|
|
|
|
|
*/
|
2023-03-31 03:17:41 +02:00
|
|
|
export interface IReceiver {
|
2023-05-09 20:15:37 +02:00
|
|
|
toSubscriptionIterator: <T extends IDecodedMessage>(
|
2023-09-07 13:15:49 +05:30
|
|
|
decoders: IDecoder<T> | IDecoder<T>[]
|
2023-05-09 20:15:37 +02:00
|
|
|
) => Promise<IAsyncIterator<T>>;
|
2024-08-05 15:52:58 +05:30
|
|
|
subscribeWithUnsubscribe: SubscribeWithUnsubscribe;
|
2023-03-31 03:17:41 +02:00
|
|
|
}
|
2024-08-05 15:52:58 +05:30
|
|
|
|
|
|
|
|
type SubscribeWithUnsubscribe = <T extends IDecodedMessage>(
|
|
|
|
|
decoders: IDecoder<T> | IDecoder<T>[],
|
|
|
|
|
callback: Callback<T>
|
|
|
|
|
) => Unsubscribe | Promise<Unsubscribe>;
|