1 | import Observable from 'zen-observable-ts';
|
2 | import { ConnectionState } from '../types/PubSub';
|
3 | declare type LinkedConnectionState = 'connected' | 'disconnected';
|
4 | declare type LinkedHealthState = 'healthy' | 'unhealthy';
|
5 | declare type LinkedConnectionStates = {
|
6 | networkState: LinkedConnectionState;
|
7 | connectionState: LinkedConnectionState | 'connecting';
|
8 | intendedConnectionState: LinkedConnectionState;
|
9 | keepAliveState: LinkedHealthState;
|
10 | };
|
11 | export declare const CONNECTION_CHANGE: {
|
12 | [key in 'KEEP_ALIVE_MISSED' | 'KEEP_ALIVE' | 'CONNECTION_ESTABLISHED' | 'CONNECTION_FAILED' | 'CLOSING_CONNECTION' | 'OPENING_CONNECTION' | 'CLOSED' | 'ONLINE' | 'OFFLINE']: Partial<LinkedConnectionStates>;
|
13 | };
|
14 | export declare class ConnectionStateMonitor {
|
15 | |
16 |
|
17 |
|
18 | private _linkedConnectionState;
|
19 | private _linkedConnectionStateObservable;
|
20 | private _linkedConnectionStateObserver;
|
21 | private _networkMonitoringSubscription?;
|
22 | private _initialNetworkStateSubscription?;
|
23 | constructor();
|
24 | /**
|
25 | * Turn network state monitoring on if it isn't on already
|
26 | */
|
27 | private enableNetworkMonitoring;
|
28 | /**
|
29 | * Turn network state monitoring off if it isn't off already
|
30 | */
|
31 | private disableNetworkMonitoring;
|
32 | /**
|
33 | * Get the observable that allows us to monitor the connection state
|
34 | *
|
35 | * @returns {Observable<ConnectionState>} - The observable that emits ConnectionState updates
|
36 | */
|
37 | get connectionStateObservable(): Observable<ConnectionState>;
|
38 | record(statusUpdates: Partial<LinkedConnectionStates>): void;
|
39 | private connectionStatesTranslator;
|
40 | }
|
41 | export {};
|