feat: Enable WebSocket compression for bandwidth optimization

## Simple and Safe Bandwidth Optimization

### Single Line Change
- Added `EnableCompression: true` to WebSocket upgrader
- Enables automatic deflate compression for all WebSocket messages
- No other code changes required

### Expected Benefits
- 60-90% reduction in WebSocket message size
- Automatic compression/decompression handled by browser and Go
- Particularly effective for JSON data with repeated field names
- No impact on functionality or reliability

### Why This Approach
- Minimal risk - single configuration flag
- Immediate benefits without complex logic
- Built-in browser and Go support
- No client-side changes needed
- Easy to disable if issues arise

This provides significant bandwidth savings with zero complexity,
allowing us to evaluate the impact before considering more advanced
optimizations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-09-12 13:53:34 +02:00
commit 30fcf1a58e

View file

@ -123,8 +123,9 @@ func NewWebServer(host string, port int, merger *merger.Merger, database *databa
CheckOrigin: func(r *http.Request) bool {
return true // Allow all origins in development
},
ReadBufferSize: 8192,
WriteBufferSize: 8192,
ReadBufferSize: 8192,
WriteBufferSize: 8192,
EnableCompression: true, // Enable WebSocket compression for bandwidth savings
},
broadcastChan: make(chan []byte, 2000), // Increased buffer size to handle bursts
stopChan: make(chan struct{}),