http-request-manager 18.15.31 → 18.15.32

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.
@@ -1655,7 +1655,7 @@ class WebsocketService {
1655
1655
  }
1656
1656
  sendMessageInChannel(channel, content) {
1657
1657
  if (this.socket?.readyState === WebSocket.OPEN) {
1658
- this.socket.send(JSON.stringify({ type: 'stateMangerMessage', subscribedChannel: channel, content }));
1658
+ this.socket.send(JSON.stringify({ type: 'statemanagerMessage', subscribedChannel: channel, content }));
1659
1659
  this.logger.debug('WebSocket', `💬 Send message`, { channel, content });
1660
1660
  }
1661
1661
  else {
@@ -1875,6 +1875,7 @@ class WebSocketManagerService {
1875
1875
  static { this.retryDelay = 5000; }
1876
1876
  static { this.retrySubscription = null; }
1877
1877
  static { this.maxRetries = 10; }
1878
+ static { this.connectionReadyNotified = false; }
1878
1879
  static { this.retryCountSubject = new BehaviorSubject(0); }
1879
1880
  static { this.maxRetriesSubject = new BehaviorSubject(10); }
1880
1881
  // ═══════════════════════════════════════════════════════════════════════════
@@ -1968,6 +1969,7 @@ class WebSocketManagerService {
1968
1969
  // Mark as connecting — connectionStatus true while connecting/retrying, false only when exhausted
1969
1970
  WebSocketManagerService.isConnecting = true;
1970
1971
  WebSocketManagerService.isSubscribed = false;
1972
+ WebSocketManagerService.connectionReadyNotified = false;
1971
1973
  WebSocketManagerService.subscribedChannels.next(new Set());
1972
1974
  WebSocketManagerService.connectionStatus.next(true);
1973
1975
  const sessionId = this.getSessionId();
@@ -2002,11 +2004,15 @@ class WebSocketManagerService {
2002
2004
  return;
2003
2005
  }
2004
2006
  // First valid (non-error) message confirms the server accepted auth.
2005
- // Reset retry counter now that we have a stable connection.
2006
- if (WebSocketManagerService.retryCount > 0) {
2007
- console.log(`✅ Server confirmed connection after ${WebSocketManagerService.retryCount} retries.`);
2008
- WebSocketManagerService.retryCount = 0;
2009
- WebSocketManagerService.retryCountSubject.next(0);
2007
+ // Notify readiness once per connection so pending intended subscriptions
2008
+ // are replayed after the socket is actually usable.
2009
+ if (!WebSocketManagerService.connectionReadyNotified) {
2010
+ if (WebSocketManagerService.retryCount > 0) {
2011
+ console.log(`✅ Server confirmed connection after ${WebSocketManagerService.retryCount} retries.`);
2012
+ WebSocketManagerService.retryCount = 0;
2013
+ WebSocketManagerService.retryCountSubject.next(0);
2014
+ }
2015
+ WebSocketManagerService.connectionReadyNotified = true;
2010
2016
  console.log(`🔄 Emitting reconnect event for MessageTrackerService`);
2011
2017
  WebSocketManagerService.onReconnect.next();
2012
2018
  }
@@ -2019,6 +2025,7 @@ class WebSocketManagerService {
2019
2025
  WebSocketManagerService.socket.onclose = (event) => {
2020
2026
  console.log(`🔴 WebSocket closed (code: ${event.code})`);
2021
2027
  WebSocketManagerService.isConnecting = false;
2028
+ WebSocketManagerService.connectionReadyNotified = false;
2022
2029
  WebSocketManagerService.socket = null;
2023
2030
  WebSocketManagerService.subscribedChannels.next(new Set());
2024
2031
  const maxRetries = WebSocketManagerService.maxRetries;
@@ -2212,7 +2219,7 @@ class WebSocketManagerService {
2212
2219
  sendMessageInChannel(channel, content) {
2213
2220
  if (WebSocketManagerService.socket?.readyState === WebSocket.OPEN) {
2214
2221
  const message = {
2215
- type: 'stateMangerMessage',
2222
+ type: 'statemanagerMessage',
2216
2223
  subscribedChannel: channel,
2217
2224
  content
2218
2225
  };
@@ -7065,6 +7072,7 @@ class HTTPManagerStateService extends ComponentStore {
7065
7072
  WebSocketManagerService.addSubscribedChannel(channelName);
7066
7073
  }
7067
7074
  break;
7075
+ case 'statemanagerMessage':
7068
7076
  case 'stateMangerMessage':
7069
7077
  // CRITICAL DEBUG: Log channel comparison
7070
7078
  console.log('🔍 [STATE STORE] stateMangerMessage received:', {