@voicenter-team/events-sdk 0.0.110 → 0.0.111

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.
@@ -137,7 +137,7 @@ declare interface CurrentCallEnded extends CurrentCallUTCExtended {
137
137
  duration: number
138
138
  }
139
139
 
140
- declare interface CurrentCallUTCExtended extends ExtensionCall {
140
+ export declare interface CurrentCallUTCExtended extends ExtensionCall {
141
141
  callStarted_UTC: number
142
142
  callStarted_UTC_CLIENT: number
143
143
  callAnswered_UTC: number
@@ -809,6 +809,7 @@ declare class LoggerClass {
809
809
  keepAliveEmit(): void;
810
810
  keepAliveResponse(data: KeepAliveResponseEvent): void;
811
811
  eventLog<T extends EventTypeNames>(eventName: T, data: EventDataMap[T]): void;
812
+ private getStaticData;
812
813
  }
813
814
 
814
815
  export declare interface LoggerConfig {
@@ -1136,24 +1137,74 @@ export declare interface Socket {
1136
1137
  Version: string
1137
1138
  }
1138
1139
 
1140
+ /**
1141
+ * SocketIoClass handles WebSocket connections and real-time event management.
1142
+ * Prevents duplicate connections and events with robust state management.
1143
+ */
1139
1144
  declare class SocketIoClass {
1140
1145
  private readonly eventsSdkClass;
1141
- constructor(eventsSdkClass: EventsSdkClass);
1146
+ /** The active Socket.IO connection instance */
1142
1147
  io: SocketTyped | undefined;
1148
+ /** The Socket.IO function used to create connections based on version */
1143
1149
  ioFunction: TypedSocketIo | undefined;
1150
+ /** Timestamp of the last received event, used for keep-alive calculations */
1144
1151
  lastEventTimestamp: number;
1152
+ /** Flag indicating whether automatic reconnection should be attempted */
1145
1153
  doReconnect: boolean;
1154
+ /** Current connection state */
1155
+ private connectionState;
1156
+ /** Keep-alive interval handle */
1146
1157
  private keepAliveInterval;
1147
- private keepReconnectInterval;
1148
- private keepReconnectTimeout;
1149
- private connected;
1158
+ /** Reconnection timeout handle */
1159
+ private reconnectTimeout;
1160
+ /** Network reconnect timeout handle (debounced) */
1161
+ private networkReconnectTimeout;
1162
+ /** Current reconnection delay in seconds */
1150
1163
  private reconnectionTime;
1164
+ /** Maximum reconnection delay in seconds */
1165
+ private readonly maxReconnectionDelay;
1166
+ /** Network event cleanup functions */
1167
+ private networkCleanup;
1168
+ /**
1169
+ * Creates an instance of SocketIoClass and sets up network event listeners.
1170
+ */
1171
+ constructor(eventsSdkClass: EventsSdkClass);
1172
+ /**
1173
+ * Sets up network event listeners
1174
+ */
1175
+ private setupNetworkListeners;
1176
+ /**
1177
+ * Handles network online with debouncing to prevent rapid reconnects
1178
+ */
1179
+ private handleNetworkOnline;
1180
+ /**
1181
+ * Determines and sets the appropriate Socket.IO function based on client version.
1182
+ */
1151
1183
  getSocketIoFunction(Client: string): void;
1184
+ /**
1185
+ * Initializes a new Socket.IO connection. Prevents multiple simultaneous connections.
1186
+ */
1152
1187
  initSocketConnection(): void;
1188
+ /**
1189
+ * Clears the keep-alive interval
1190
+ */
1153
1191
  clearKeepAliveInterval(): void;
1192
+ /**
1193
+ * Initializes the keep-alive mechanism
1194
+ */
1154
1195
  initKeepAlive(): void;
1155
- closeAllConnections(): void;
1196
+ /**
1197
+ * Closes all active connections and cleans up resources properly
1198
+ */
1199
+ closeAllConnections(): Promise<void>;
1200
+ /**
1201
+ * Sets up event listeners for all Socket.IO events
1202
+ */
1156
1203
  initSocketEvents(): void;
1204
+ /**
1205
+ * Updates timestamp on every event to prevent unnecessary keep-alives
1206
+ */
1207
+ private updateEventTimestamp;
1157
1208
  private onLoginSuccessEvent;
1158
1209
  private onQueueEvent;
1159
1210
  private onExtensionEvent;
@@ -1161,11 +1212,31 @@ declare class SocketIoClass {
1161
1212
  private onLoginStatusEvent;
1162
1213
  private onAllExtensionStatus;
1163
1214
  private onAllDialerStatus;
1215
+ /**
1216
+ * Handles keep-alive response - fixed to prevent multiple connections
1217
+ */
1164
1218
  private onKeepAliveResponse;
1165
1219
  private onExtensionsUpdatedEvent;
1220
+ /**
1221
+ * Handles successful connection
1222
+ */
1166
1223
  private onConnect;
1224
+ /**
1225
+ * Schedules reconnection with exponential backoff
1226
+ */
1227
+ private scheduleReconnect;
1228
+ /**
1229
+ * Handles disconnection
1230
+ */
1167
1231
  private onDisconnect;
1232
+ /**
1233
+ * Handles connection errors
1234
+ */
1168
1235
  private onConnectError;
1236
+ /**
1237
+ * Cleanup when shutting down
1238
+ */
1239
+ destroy(): Promise<void>;
1169
1240
  }
1170
1241
 
1171
1242
  export declare type SocketTyped = Socket_2<EventCallbackRegistry, ServerEmitEventCallbackRegistry>