UNPKG

@mixer/interactive-node

Version:

A NodeJS and Browser compatible client for mixer.com's interactive 2 Protocol

31 lines (30 loc) 1.02 kB
/** * A ReconnectionPolicy describes how long to wait before attempting to * reconnect to the websocket if the connection drops. */ export interface IReconnectionPolicy { /** * next provides the next reconnect delay, in ms. */ next(): number; /** * Resets an internal counter of reconnection attempts, 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 IReconnectionPolicy { 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; }