Skip to content

WebSocket traffic support + GitHub Packages publishing - #1

Merged
simonvar merged 2 commits into
mainfrom
feature/websocket-support
Jul 13, 2026
Merged

WebSocket traffic support + GitHub Packages publishing#1
simonvar merged 2 commits into
mainfrom
feature/websocket-support

Conversation

@simonvar

Copy link
Copy Markdown
Owner

Summary

Adds WebSocket traffic support to this Chucker fork so that WebSocket events — outgoing/incoming messages and the full WebSocketListener lifecycle (open / closing / closed / failure) — are captured and shown mixed into the existing transaction list. Also wires up publishing to GitHub Packages on release so the fork can be consumed by blink-android.

Motivation: blink-android's realtime transport (WebsocketRealtimeImpl) uses a dedicated interceptor-less OkHttpClient, so Chucker never observed WebSocket traffic. OkHttp does not run application interceptors on the WS frame stream, so a dedicated capture API is required rather than a ChuckerInterceptor.

WebSocket capture (public API)

  • ChuckerWebSockets.create(client, request, collector, listener) — drop-in replacement for OkHttpClient.newWebSocket(...); captures both directions and the full lifecycle.
  • ChuckerWebSocketListener — a WebSocketListener decorator (incoming + lifecycle).
  • RecordingWebSocket (internal) — wraps the returned socket to capture outgoing send().

Data & UI

  • New flat Room entity WebSocketTraffic (one row per event) + DAO + repository; ChuckerDatabase bumped to v12 (destructive migration).
  • WebSocket events are merged chronologically with HTTP transactions into the existing MainActivity list (TransactionRow + multi-view-type adapter).
  • Filter chips: All / HTTP / WS Sent / WS Received / WS Status (translated to ru/es/ja/ko).
  • Dedicated WS detail screen (type, direction, url, time, size, payload).
  • Deterministic ordering: a monotonic sequence captured synchronously at record time breaks ties when multiple events share the same millisecond (fixes SENT appearing before OPEN).

Export, notification, retention

  • Text export (Share/Save as text in the UI, ExportFormat.LOG in the API) now includes WS events mixed with HTTP, ordered by time. HAR stays HTTP-only.
  • Notification aggregates HTTP + WS; retention purges WS traffic too.
  • :library-no-op gets passthrough stubs so release builds keep compiling.

Publishing to GitHub Packages

  • gradle/gradle-github-packages.gradle adds a GitHub Packages Maven repository to the release publication (leaves upstream Sonatype setup untouched).
  • .github/workflows/publish-github-packages.yaml publishes library and library-no-op on Release → Published (and manual dispatch), using the built-in GITHUB_TOKEN (packages: write). Version is derived from the release tag.

Verification

  • :library + :library-no-op + :sample build; full :library unit test suite, detekt, and Android lint all green.
  • New unit tests: ChuckerWebSocketListener, RecordingWebSocket, TrafficListSharable (export), and a Room round-trip for the WS repository.
  • Manually verified on-device: OPEN → SENT → RECEIVED → CLOSING → CLOSED captured, chips filter correctly, WS detail opens, and text export contains both HTTP and WS.

Notes

  • Group id kept as com.github.chuckerteam.chucker so consumers can reuse the coordinate.
  • GitHub Packages requires authentication even to read packages (a PAT with read:packages), unlike JitPack/Maven Central.
  • The publish workflow must land on the default branch (main) for the release trigger to fire.

🤖 Generated with Claude Code

simonvar and others added 2 commits July 13, 2026 15:47
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@simonvar
simonvar merged commit adf930c into main Jul 13, 2026
6 checks passed
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