From bc31bed457bb949e3aceb2627bf6729ed1235dcf Mon Sep 17 00:00:00 2001 From: "Amir H. Khanjani" <72540492+ahkhanjani@users.noreply.github.com> Date: Fri, 1 Sep 2023 22:42:39 +0330 Subject: [PATCH] Add ConnectionState type A proposal for adding the union of connection states according to https://pusher.com/docs/channels/using_channels/connection/#available-states --- src/core/connection/connection_manager.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/connection/connection_manager.ts b/src/core/connection/connection_manager.ts index f913da446..01a2c1f9b 100644 --- a/src/core/connection/connection_manager.ts +++ b/src/core/connection/connection_manager.ts @@ -18,6 +18,8 @@ import { } from './callbacks'; import Action from './protocol/action'; +export type ConnectionState = 'initialized' | 'connecting' | 'connected' | 'unavailable' | 'failed' | 'disconnected'; + /** Manages connection to Pusher. * * Uses a strategy (currently only default), timers and network availability @@ -47,7 +49,7 @@ import Action from './protocol/action'; export default class ConnectionManager extends EventsDispatcher { key: string; options: ConnectionManagerOptions; - state: string; + state: ConnectionState; connection: Connection; usingTLS: boolean; timeline: Timeline;