Skip to content

fix(api-client): reconnect in place instead of spawning a second /await socket [WPB-21916]#21448

Open
thisisamir98 wants to merge 1 commit into
devfrom
WPB-21916-back-from-sleep-bug
Open

fix(api-client): reconnect in place instead of spawning a second /await socket [WPB-21916]#21448
thisisamir98 wants to merge 1 commit into
devfrom
WPB-21916-back-from-sleep-bug

Conversation

@thisisamir98
Copy link
Copy Markdown
Collaborator

@thisisamir98 thisisamir98 commented Jun 5, 2026

BugWPB-21916 [Web/Desktop] : Missing messages in Web - Prod

When connect() was called while a ReconnectingWebSocket wrapper already existed, we allocated a new RWS instance and only fire-and-forget closed the old one. That could leave two OPEN /await sessions on the same client id — both could ping/pong, but Nginz fans notifications to only one, causing silent message loss (LIVE UI, no new notifications).

Reuse the existing wrapper and call reconnect() instead. The library synchronously closes the underlying WebSocket in _disconnect before starting _connect, so the app never holds two competing sessions.

Also update the connect() unit test to assert in-place reconnect rather than close + new instance.

…it socket

When connect() was called while a ReconnectingWebSocket wrapper already
existed, we allocated a new RWS instance and only fire-and-forget closed
the old one. That could leave two OPEN /await sessions on the same client
id — both could ping/pong, but Nginz fans notifications to only one,
causing silent message loss (LIVE UI, no new notifications).

Reuse the existing wrapper and call reconnect() instead. The library
synchronously closes the underlying WebSocket in _disconnect before
starting _connect, so the app never holds two competing sessions.

Also update the connect() unit test to assert in-place reconnect rather
than close + new instance.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 5, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

🔗 Download Full Report Artifact

🧪 Playwright Test Summary

  • Passed: 15
  • Failed: 0
  • Skipped: 0
  • 🔁 Flaky: 0
  • 📊 Total: 15
  • Total Runtime: 130.1s (~ 2 min 10 sec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant