2023-03-21 02:07:59 +01:00
|
|
|
import type { IEncoder, IMessage } from "./message.js";
|
2024-05-09 16:51:08 +05:30
|
|
|
import { SDKProtocolResult } from "./protocols.js";
|
2023-03-21 02:07:59 +01:00
|
|
|
|
|
|
|
|
export interface ISender {
|
2024-06-19 01:52:16 -04:00
|
|
|
send: (
|
|
|
|
|
encoder: IEncoder,
|
|
|
|
|
message: IMessage,
|
|
|
|
|
sendOptions?: SendOptions
|
|
|
|
|
) => Promise<SDKProtocolResult>;
|
2023-03-21 02:07:59 +01:00
|
|
|
}
|
2024-06-19 01:52:16 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Options for using LightPush
|
|
|
|
|
*/
|
|
|
|
|
export type SendOptions = {
|
|
|
|
|
/**
|
|
|
|
|
* Optional flag to enable auto-retry with exponential backoff
|
|
|
|
|
*/
|
|
|
|
|
autoRetry?: boolean;
|
|
|
|
|
/**
|
|
|
|
|
* Optional flag to force using all available peers
|
|
|
|
|
*/
|
|
|
|
|
forceUseAllPeers?: boolean;
|
|
|
|
|
/**
|
|
|
|
|
* Optional maximum number of attempts for exponential backoff
|
|
|
|
|
*/
|
|
|
|
|
maxAttempts?: number;
|
|
|
|
|
/**
|
|
|
|
|
* Optional initial delay in milliseconds for exponential backoff
|
|
|
|
|
*/
|
|
|
|
|
initialDelay?: number;
|
|
|
|
|
/**
|
|
|
|
|
* Optional maximum delay in milliseconds for exponential backoff
|
|
|
|
|
*/
|
|
|
|
|
maxDelay?: number;
|
|
|
|
|
};
|