Skip to content

✨ Add webSocketObservable for WebSocket lifecycle events#4715

Draft
bdibon wants to merge 1 commit into
graphite-base/4715from
boris.dibon/ws-2-observable
Draft

✨ Add webSocketObservable for WebSocket lifecycle events#4715
bdibon wants to merge 1 commit into
graphite-base/4715from
boris.dibon/ws-2-observable

Conversation

@bdibon
Copy link
Copy Markdown
Contributor

@bdibon bdibon commented Jun 3, 2026

Motivation

Provide a low-level observable that emits WebSocket lifecycle events (connecting, open, message in/out, close). This is the browser-level building block consumed by the WebSocket collection later in the stack.

Changes

  • Add webSocketObservable (initWebSocketObservable), instrumenting the WebSocket constructor and send, and listening to open / message / close / error events.
  • Add WebSocketEventMap support to addEventListener.
  • Export the observable and its context types from @datadog/browser-core.

Test instructions

yarn test:unit --spec packages/core/src/browser/webSocketObservable.spec.ts

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

Copy link
Copy Markdown
Contributor Author

bdibon commented Jun 3, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@cit-pr-commenter-54b7da
Copy link
Copy Markdown

cit-pr-commenter-54b7da Bot commented Jun 3, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 171.88 KiB 171.88 KiB 0 B 0.00%
Rum Profiler 7.88 KiB 7.88 KiB 0 B 0.00%
Rum Recorder 21.22 KiB 21.22 KiB 0 B 0.00%
Logs 54.39 KiB 54.39 KiB 0 B 0.00%
Rum Slim 129.77 KiB 129.77 KiB 0 B 0.00%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%

@datadog-datadog-prod-us1
Copy link
Copy Markdown

datadog-datadog-prod-us1 Bot commented Jun 3, 2026

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 88.10%
Overall Coverage: 76.78% (+0.04%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 55471a3 | Docs | Datadog PR Page | Give us feedback!

@bdibon bdibon force-pushed the boris.dibon/ws-1-instrument-method-constructor branch from c445e3c to e2bdea2 Compare June 4, 2026 09:16
@bdibon bdibon force-pushed the boris.dibon/ws-2-observable branch 2 times, most recently from 9763a7b to 7b7708d Compare June 4, 2026 12:30
@bdibon bdibon changed the base branch from boris.dibon/ws-1-instrument-method-constructor to graphite-base/4715 June 4, 2026 15:00
@bdibon bdibon force-pushed the boris.dibon/ws-2-observable branch from 7b7708d to 8c31a3b Compare June 8, 2026 11:27
@bdibon bdibon changed the base branch from graphite-base/4715 to boris.dibon/ws-1-instrument-method-constructor June 8, 2026 11:27
@bdibon bdibon changed the base branch from boris.dibon/ws-1-instrument-method-constructor to graphite-base/4715 June 8, 2026 11:52
Co-authored-by: Cursor <cursoragent@cursor.com>
@bdibon bdibon force-pushed the boris.dibon/ws-2-observable branch from 8c31a3b to 55471a3 Compare June 8, 2026 14:28
@bdibon bdibon changed the base branch from graphite-base/4715 to boris.dibon/ws-1-instrument-method-constructor June 8, 2026 14:28
@bdibon bdibon changed the base branch from boris.dibon/ws-1-instrument-method-constructor to graphite-base/4715 June 8, 2026 15:12
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