2023-03-21 02:07:59 +01:00
|
|
|
import type { IEncoder, IMessage } from "./message.js";
|
2025-09-04 15:52:37 -07:00
|
|
|
import { LightPushSDKResult } from "./protocols.js";
|
2024-10-17 00:49:24 +02:00
|
|
|
|
2025-02-25 22:40:03 +01:00
|
|
|
export type ISendOptions = {
|
2024-10-17 00:49:24 +02:00
|
|
|
/**
|
|
|
|
|
* Enables retry of a message that was failed to be sent.
|
2025-02-25 22:40:03 +01:00
|
|
|
* @default true
|
2024-10-17 00:49:24 +02:00
|
|
|
*/
|
|
|
|
|
autoRetry?: boolean;
|
2025-02-25 22:40:03 +01:00
|
|
|
|
2024-10-17 00:49:24 +02:00
|
|
|
/**
|
|
|
|
|
* Sets number of attempts if `autoRetry` is enabled.
|
|
|
|
|
* @default 3
|
|
|
|
|
*/
|
|
|
|
|
maxAttempts?: number;
|
2025-09-04 15:52:37 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Use v2 of the light push protocol.
|
|
|
|
|
* This parameter will be removed in the future.
|
|
|
|
|
* @default false
|
|
|
|
|
*/
|
|
|
|
|
useLegacy?: boolean;
|
2024-10-17 00:49:24 +02:00
|
|
|
};
|
2023-03-21 02:07:59 +01:00
|
|
|
|
|
|
|
|
export interface ISender {
|
2024-06-19 01:52:16 -04:00
|
|
|
send: (
|
|
|
|
|
encoder: IEncoder,
|
|
|
|
|
message: IMessage,
|
2025-02-25 22:40:03 +01:00
|
|
|
sendOptions?: ISendOptions
|
2025-09-04 15:52:37 -07:00
|
|
|
) => Promise<LightPushSDKResult>;
|
2023-03-21 02:07:59 +01:00
|
|
|
}
|