@iotize/tap
Version:
IoTize Device client for Javascript
53 lines (52 loc) • 1.34 kB
TypeScript
import '@iotize/tap/service/impl/interface';
import { Tap } from '@iotize/tap';
import { Observable } from 'rxjs';
export declare const DEFAULT_KEEP_ALIVE_PERIOD_MS = 5000;
export declare type KeepAliveEvent = KeepAliveEventError | KeepAliveEventTick | KeepAliveEventScheduleTick | {
type: 'start';
} | {
type: 'stop';
};
interface KeepAliveEventError {
type: 'error';
error: Error;
}
interface KeepAliveEventTick {
type: 'tick';
}
interface KeepAliveEventScheduleTick {
type: 'rescheduleKeepAlive';
timeout: number;
}
export interface KeepAliveOptions {
period: number;
}
export declare class KeepAliveEngine {
private tap;
private _options;
private timeoutId?;
private _lastResponseTime;
private _isStopped;
private _frameCounter;
/**
* Keep alive request count
*/
get counter(): number;
/**
* returns event observable
*/
get events(): Observable<KeepAliveEvent>;
private _events;
/**
* Change keep alive period
*/
set period(p: number);
get running(): boolean;
get options(): Readonly<KeepAliveOptions>;
constructor(tap: Tap, _options: KeepAliveOptions);
start(): void;
stop(): void;
private clearTimeout;
private _setupNextTimeout;
}
export {};