Skip to content

fix: probe only read-idle WebSockets - #355

Merged
linkdata merged 8 commits into
mainfrom
fix/issue-354-idle-heartbeat
Aug 14, 2026
Merged

fix: probe only read-idle WebSockets#355
linkdata merged 8 commits into
mainfrom
fix/issue-354-idle-heartbeat

Conversation

@linkdata

@linkdata linkdata commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • probe a WebSocket only after its read has remained pending for WebSocketPingInterval; local parsing and delivery do not count toward the interval
  • keep a socket reader active during each probe so incoming data remains deliverable while the ping awaits its pong
  • bound each outbound WebSocket write with requestTimeout, preventing a blocked write from wedging the outbound queue and Request loop

The pre-release lib/wire API now requires positive durations: ReadLoop accepts the idle interval and ping timeout, WriteLoop accepts the write timeout, and PingLoop is removed.

Tests

  • added real-WebSocket regressions for a responsive client during slow local processing and for a non-reading client that backpressures the outbound path
  • added deterministic wire tests for idle and ping-timeout boundaries, activity during a probe, and per-write timeout renewal and enforcement
  • go generate ./...
  • go vet ./...
  • gofmt -l .
  • gofumpt -l .
  • staticcheck ./...
  • golangci-lint run
  • gosec ./...
  • JAWS_REQUIRE_NODE=1 go test -race -coverprofile=coverage.out ./... (99.8% overall; lib/wire 100%)
  • JAWS_REQUIRE_NODE=1 go test ./...
  • go build -v ./...

Closes #354

@linkdata
linkdata merged commit 7b0639a into main Aug 14, 2026
7 checks passed
@linkdata
linkdata deleted the fix/issue-354-idle-heartbeat branch August 14, 2026 18:32
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.

wire: blocked inbound delivery causes false keepalive timeouts

1 participant