openclaw - 💡(How to fix) Fix WebChat: WebSocket drops every 1-5 minutes on Safari, loses messages and tool-call events on reconnect [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60594Fetched 2026-04-08 02:49:21
View on GitHub
Comments
1
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
commented ×1

Error Message

The Control UI webchat WebSocket connection drops frequently (every 1-5 minutes) when opened in Safari on macOS. After reconnect, messages and events (tool call displays, error messages) that occurred during the disconnect are lost — the user sees a stale view and must manually refresh. 3. Error messages only go to Telegram — e.g., JSON parse errors surface on Telegram but never appear in webchat 3. Tool call events and error messages should be persisted and delivered on reconnect, not silently dropped

Root Cause

Root Cause Hypothesis

Fix Action

Workaround

Using Chrome instead of Safari (Chrome is less aggressive with background tab throttling).

Code Example

10:31:50 webchat connected  conn=b48cf656
10:41:53 webchat disconnected code=1001 conn=b48cf656
10:41:53 webchat connected  conn=3bc4de91
10:42:06 webchat disconnected code=1001 conn=3bc4de91
10:42:06 webchat connected  conn=725a9d96
10:42:49 webchat disconnected code=1001 conn=725a9d96
10:42:49 webchat connected  conn=e7755809
RAW_BUFFERClick to expand / collapse

Bug Description

The Control UI webchat WebSocket connection drops frequently (every 1-5 minutes) when opened in Safari on macOS. After reconnect, messages and events (tool call displays, error messages) that occurred during the disconnect are lost — the user sees a stale view and must manually refresh.

Symptoms

  1. New messages don't appear — user has to manually refresh the page to see new responses
  2. Tool call events not displayed — tool invocations that happen while WS is disconnected are never shown
  3. Error messages only go to Telegram — e.g., JSON parse errors surface on Telegram but never appear in webchat
  4. WebSocket reconnects successfully but does not backfill missed messages/events

Log Evidence

WebSocket repeatedly disconnects with code 1001 (Going Away), reconnects immediately, but no gap-fill occurs:

10:31:50 webchat connected  conn=b48cf656
10:41:53 webchat disconnected code=1001 conn=b48cf656
10:41:53 webchat connected  conn=3bc4de91
10:42:06 webchat disconnected code=1001 conn=3bc4de91
10:42:06 webchat connected  conn=725a9d96
10:42:49 webchat disconnected code=1001 conn=725a9d96
10:42:49 webchat connected  conn=e7755809

Pattern is consistent throughout the day — connections last ~30s to ~10min before dropping.

Root Cause Hypothesis

Safari aggressively throttles/suspends WebSocket connections in background tabs (App Nap / Tab Throttling). The webchat client reconnects but does not request missed messages from the gateway after reconnecting.

Expected Behavior

  1. On reconnect, the client should request and display any messages/events that occurred during the disconnect (gap-fill / replay from last-seen sequence)
  2. Ideally, implement keepalive pings to prevent Safari from suspending the connection
  3. Tool call events and error messages should be persisted and delivered on reconnect, not silently dropped

Workaround

Using Chrome instead of Safari (Chrome is less aggressive with background tab throttling).

Environment

  • OpenClaw: v2026.4.2 (d74a122)
  • Browser: Safari on macOS 26.3.1
  • Gateway: local (ws://127.0.0.1:18789)
  • Channel: Telegram (primary), WebChat (Control UI)

extent analysis

TL;DR

Implementing a keepalive mechanism, such as sending periodic pings over the WebSocket connection, may help prevent Safari from throttling the connection.

Guidance

  • Investigate the feasibility of implementing a keepalive ping mechanism in the webchat client to maintain an active connection and prevent Safari's aggressive throttling.
  • Verify if the WebSocket gateway supports and can handle keepalive pings without issues.
  • Consider modifying the webchat client to request missed messages and events upon reconnect, ensuring a seamless user experience.
  • Review the WebSocket connection settings and parameters to ensure they are optimized for the specific use case and environment.

Example

A simple keepalive ping mechanism could involve sending a small message over the WebSocket connection at regular intervals, e.g., every 10-15 seconds, to keep the connection active.

Notes

The effectiveness of the keepalive mechanism may vary depending on Safari's specific throttling behavior and the WebSocket gateway's implementation. Testing and verification are necessary to ensure the chosen solution works as expected.

Recommendation

Apply a workaround by implementing a keepalive ping mechanism to prevent Safari from throttling the WebSocket connection, as upgrading to a fixed version is not mentioned as an option in the issue description.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix WebChat: WebSocket drops every 1-5 minutes on Safari, loses messages and tool-call events on reconnect [1 comments, 1 participants]