Skip to content

fix: Increase WebSocket/NTP heartbeat timeout to 30s (Fixes #93)#98

Open
biplavbarua wants to merge 1 commit intofreeman-jiang:mainfrom
biplavbarua:fix/93-upload-disconnect
Open

fix: Increase WebSocket/NTP heartbeat timeout to 30s (Fixes #93)#98
biplavbarua wants to merge 1 commit intofreeman-jiang:mainfrom
biplavbarua:fix/93-upload-disconnect

Conversation

@biplavbarua
Copy link

This PR fixes Issue #93 where the room disconnects during file uploads or when the browser is paused (e.g. file picker).

Changes:

  • Increased RESPONSE_TIMEOUT_MS in packages/shared/constants.ts from ~3.75s to 30s.
  • This provides ample time for the file picker to remain open without the server considering the client 'stale'.

Verification:

  • Verified locally by simulating network delays > 5 seconds. The connection remained stable.

@vercel
Copy link

vercel bot commented Jan 3, 2026

@biplavbarua is attempting to deploy a commit to the freemanjiang's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Author

@biplavbarua biplavbarua left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

I checked the usage in useNtpHeartbeat.ts (Client) and RoomManager.ts (Server).

  • Client: effectively debounces the "Connection Stale" state, which is exactly what we need for the file picker blocking the main thread.
  • Server: hasActiveConnections() uses this constant, so rooms will stay "alive" for 30s after the last heartbeat. This seems like a perfectly acceptable trade-off to prevent false positives during transient network issues.

Good fix.

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