UNPKG

carina

Version:

A NodeJS and Browser compatible client for Mixer.com's constellation socket.

31 lines (30 loc) 1.01 kB
/** * A ReconnectionPolicy describes how long to wait before attempting to * reconnect to the websocket if the connection drops. */ export interface ReconnectionPolicy { /** * next provides the next reconnect delay, in ms. */ next(): number; /** * Resets an internal counter of reconnection's, should be called on a successful connection. */ reset(): void; } /** * The ExponentialReconnectionPolicy is a policy which reconnects the socket * on a delay specified by the equation min(maxDelay, attempts^2 * baseDelay). */ export declare class ExponentialReconnectionPolicy implements ReconnectionPolicy { maxDelay: number; baseDelay: number; private retries; /** * @param {Number} maxDelay maximum duration to wait between reconnection attempts * @param {Number} baseDelay delay, in milliseconds, to use in */ constructor(maxDelay?: number, baseDelay?: number); next(): number; reset(): void; }