@slide-computer/signer-web
Version:
JavaScript and TypeScript library to communicate with web signers on the Internet Computer
44 lines (43 loc) • 1.42 kB
TypeScript
export interface HeartbeatServerOptions {
/**
* The initial server status to return to the client
* @default "ready"
*/
status?: "pending" | "ready";
/**
* The allowed origin that the communication channel can be established with, recommended for secure re-establishment
*/
allowedOrigin?: string | null;
/**
* Callback when first heartbeat has been received
*/
onEstablish: (origin: string, source: WindowProxy) => void;
/**
* Reasonable time in milliseconds in which the communication channel needs to be established
* @default 10000
*/
establishTimeout?: number;
/**
* Callback when no heartbeats have been received for {@link establishTimeout} milliseconds
*/
onEstablishTimeout: () => void;
/**
* Time in milliseconds of not receiving heartbeat requests after which the communication channel is disconnected
* @default 2000
*/
disconnectTimeout?: number;
/**
* Callback when no heartbeats have been received for {@link disconnectTimeout} milliseconds
*/
onDisconnect: () => void;
/**
* Signer window, used to listen for incoming message events
* @default globalThis.window
*/
window?: Window;
}
export declare class HeartbeatServer {
#private;
constructor(options: HeartbeatServerOptions);
changeStatus(status: "pending" | "ready"): void;
}