2nd November 2025 — WebSocket Timeout Prevention #63
Fixed WebSocket connections closing during large file uploads by configuring HTTP server and socket timeouts with TCP keep-alive.
Where to Find It
- Gallery: Large album uploads
- Image Management: Batch image operations
- Any Long-Running Operation: Using WebSocket progress tracking
Benefits
- No Upload Timeouts: WebSocket connections stay alive during large file uploads
- Extended Operations: 10-minute HTTP timeout allows long-running image resize operations
- Reliable Progress: Real-time progress tracking works throughout entire upload
- Better Keep-Alive: TCP keep-alive with 30-second interval prevents connection drops
- Cleaner Error Handling: Remove code 1006 from allowable status codes (indicates abnormal closure)
Technical Details
Problem:
- Uploading large number of files caused WebSocket connections to close with error code 1006
- Default 120-second timeout too short for image resize operations
- Connections lost after ~2 minutes during batch uploads
Solution:
- Configure HTTP server with 10-minute timeout (was 120s default)
- Set socket timeout to 0 (unlimited) and enable TCP keep-alive (30s interval)
- Add clientTracking and disable perMessageDeflate on WebSocket server
- Remove code 1006 from allowable status codes (abnormal closure indicator)
- Existing ping/pong mechanism (10s client, 30s server) + timeout settings allow completion
Changes:
- HTTP server timeout: 600000ms (10 minutes)
- Socket timeout: 0 (unlimited)
- TCP keep-alive: enabled with 30-second interval
- WebSocket server: clientTracking enabled, perMessageDeflate disabled