Skip to content

fix: preserve data channel message order#16

Merged
mertushka merged 1 commit into
mainfrom
fix/datachannel-message-ordering
Jun 14, 2026
Merged

fix: preserve data channel message order#16
mertushka merged 1 commit into
mainfrom
fix/datachannel-message-ordering

Conversation

@mertushka

Copy link
Copy Markdown
Owner

Purpose

Prevent a later native RTCDataChannel message batch from overtaking messages already queued for JavaScript delivery.

Root cause

The direct native-batch dispatch fast path did not account for older messages waiting in _queuedMessageEvents. On timing-sensitive platforms, notably macOS with Node 24, a later batch could be delivered before the scheduled queue flush.

Behavior impact

Ordered data channels now preserve FIFO ordering across queued and directly dispatched native batches. The normal fast path remains active whenever the queue is empty and adds only one array-length check per native batch.

Native and WPT impact

No native bridge changes. The selected WPT manifest is unchanged. Targeted RTCDataChannel-send.html validation passed 26/26.

Browser impact

Chrome interoperability scenarios passed, including ordered Unicode bursts, binary messages, close behavior, and repeated negotiations.

Validation

  • npm run check
  • npm run native:check
  • npm test (53/53)
  • npm run api:check
  • npm run types:check
  • npm run pack:check
  • npm run wpt:selection:check
  • npm run wpt:test -- webrtc/RTCDataChannel-send.html (26/26)
  • npm run e2e:chrome
  • 30 focused regression iterations
  • Local A/B throughput checks found no measurable real transport regression

The full selected WPT suite was not rerun locally because targeted coverage exercises the affected behavior and the full matrix runs in the independent Conformance workflow.

@mertushka mertushka merged commit 6fd8ac1 into main Jun 14, 2026
19 checks passed
@mertushka mertushka deleted the fix/datachannel-message-ordering branch June 14, 2026 18:37
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