@ikonai/sdk 1.0.28 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,6 +75,8 @@ export declare class ChannelManager {
75
75
  private shouldReconnect;
76
76
  private entrypoints;
77
77
  private abortController;
78
+ private demotedTypes;
79
+ private connectionStable;
78
80
  private readonly config;
79
81
  constructor(config: ChannelManagerConfig);
80
82
  /**
@@ -102,6 +104,13 @@ export declare class ChannelManager {
102
104
  * Send a protocol message to all channels (for broadcast messages).
103
105
  */
104
106
  sendToAll(message: ProtocolMessage): void;
107
+ /**
108
+ * Check health of all channels.
109
+ * Used after tab resume to detect WebSockets closed by the OS while suspended.
110
+ * Only checks when connected — non-sudden disconnects (SDK-initiated or server
111
+ * stopping) clear the channels and transition to idle/stopped before this runs.
112
+ */
113
+ checkHealth(): void;
105
114
  /**
106
115
  * Internal connect implementation.
107
116
  * @param isReconnect - If true, don't set offline state on failure (let attemptReconnect handle it)
@@ -128,7 +137,8 @@ export declare class ChannelManager {
128
137
  */
129
138
  private handleChannelClose;
130
139
  /**
131
- * Attempt to reconnect with exponential backoff.
140
+ * Attempt to reconnect with fixed-interval retry.
141
+ * First attempt is immediate, subsequent attempts wait reconnectBackoffMs.
132
142
  */
133
143
  private attemptReconnect;
134
144
  /**
@@ -78,6 +78,11 @@ export declare class Channel {
78
78
  * Disconnect the channel.
79
79
  */
80
80
  disconnect(): void;
81
+ /**
82
+ * Check transport health and trigger close if the connection is dead.
83
+ * Used after tab resume to detect WebSockets closed by the OS while suspended.
84
+ */
85
+ checkHealth(): void;
81
86
  /**
82
87
  * Send a protocol message through the channel.
83
88
  */
@@ -175,17 +175,18 @@ export interface TimeoutConfig {
175
175
  /**
176
176
  * Keepalive timeout in milliseconds.
177
177
  * If no keepalive is received within this time, the connection is considered dead.
178
- * Default: 35000 (35 seconds)
178
+ * Default: 15000 (15 seconds)
179
179
  */
180
180
  keepaliveTimeoutMs?: number;
181
181
  /**
182
- * Initial backoff for reconnection in milliseconds.
183
- * Default: 1000 (1 second)
182
+ * Fixed delay between reconnection attempts in milliseconds.
183
+ * The first attempt is immediate; subsequent attempts wait this duration.
184
+ * Default: 2000 (2 seconds)
184
185
  */
185
186
  reconnectBackoffMs?: number;
186
187
  /**
187
- * Maximum number of reconnection attempts.
188
- * Default: 5
188
+ * Maximum number of reconnection attempts before falling back to full re-authentication.
189
+ * Default: 2
189
190
  */
190
191
  maxReconnectAttempts?: number;
191
192
  }
@@ -335,7 +336,7 @@ export interface IkonClientConfig {
335
336
  }
336
337
  export declare const DEFAULT_SLOW_CONNECTION_THRESHOLD_MS = 5000;
337
338
  export declare const DEFAULT_CONNECTION_TIMEOUT_MS = 30000;
338
- export declare const DEFAULT_KEEPALIVE_TIMEOUT_MS = 35000;
339
- export declare const DEFAULT_RECONNECT_BACKOFF_MS = 500;
340
- export declare const DEFAULT_MAX_RECONNECT_ATTEMPTS = 6;
339
+ export declare const DEFAULT_KEEPALIVE_TIMEOUT_MS = 15000;
340
+ export declare const DEFAULT_RECONNECT_BACKOFF_MS = 2000;
341
+ export declare const DEFAULT_MAX_RECONNECT_ATTEMPTS = 2;
341
342
  export declare const DEFAULT_PROVISIONING_TIMEOUT_MS = 60000;
@@ -129,6 +129,9 @@ export declare class IkonClient {
129
129
  private _webRtcAudioStreams;
130
130
  private _webRtcVideoStreams;
131
131
  private _webRtcTrackMap;
132
+ private _keepaliveLockAbort;
133
+ private _fullReauthAttempted;
134
+ private _reauthInProgress;
132
135
  private _waitForExternalConnectUrl;
133
136
  private _externalConnectUrlCleanup;
134
137
  /**
@@ -310,6 +313,17 @@ export declare class IkonClient {
310
313
  private disconnectProtocol;
311
314
  private computeOrderedEndpointTypes;
312
315
  private updateWorkerInterestMask;
316
+ /**
317
+ * Acquire a Web Lock to signal the browser that the tab is doing important work.
318
+ * This helps prevent Safari from freezing the tab while connected.
319
+ */
320
+ private acquireKeepaliveLock;
321
+ /**
322
+ * Release the Web Lock acquired by acquireKeepaliveLock.
323
+ */
324
+ private releaseKeepaliveLock;
325
+ private canAttemptFullReauth;
326
+ private attemptFullReauth;
313
327
  /**
314
328
  * Clear all timers.
315
329
  */