Skip to content

fix: small tauri websocket improvements#1764

Merged
peterchinman merged 5 commits intomainfrom
peter/small-tauri-websocket-improvements
Mar 9, 2026
Merged

fix: small tauri websocket improvements#1764
peterchinman merged 5 commits intomainfrom
peter/small-tauri-websocket-improvements

Conversation

@peterchinman
Copy link
Copy Markdown
Contributor

@peterchinman peterchinman commented Mar 3, 2026

Fixes several edge cases in the Tauri WebSocket wrapper to better match native WebSocket behavior:

  • Fire close after connection error: When a Tauri WebSocket connection fails, a close event is now emitted after the error event (code 1006). Native WebSockets always follow error with close, which the upper Websocket layer relies on to schedule reconnect retries.
  • Fire close after send failure: If a .send() call rejects (e.g. the connection dropped mid-send), the socket now transitions to CLOSED and fires error + close events rather than silently failing.
  • Set wasClean: true on normal close: The close event fired on a clean server-initiated close now correctly sets wasClean: true.
  • Handle already-CLOSED socket in heartbeat: The heartbeat logic now also triggers cleanup when the underlying socket is in the CLOSED state (not just CLOSING), preventing stale connections from going undetected.

A comprehensive test suite for TauriWebSocketWrapper is also added.

Additionally does drive-by fixes on other things noticed in mobile sentry logs:

  • unnecessary non-null assertion in layoutManager
  • reduces the severity of a log from FloatingMenuContext.

@peterchinman peterchinman requested a review from a team as a code owner March 3, 2026 21:28
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 3, 2026

@peterchinman peterchinman requested a review from synoet March 4, 2026 22:57
Copy link
Copy Markdown
Contributor

@synoet synoet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restore / delete the changes to test

@peterchinman peterchinman merged commit 284482e into main Mar 9, 2026
22 checks passed
@peterchinman peterchinman deleted the peter/small-tauri-websocket-improvements branch March 9, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants