Skip to content

fix(webrtc): wait for Node ICE gathering before sending SDP answer - #45

Merged
akirilyuk merged 2 commits into
mainfrom
cursor/node-ice-answer-wait-gathering-c5cf
Aug 14, 2026
Merged

fix(webrtc): wait for Node ICE gathering before sending SDP answer#45
akirilyuk merged 2 commits into
mainfrom
cursor/node-ice-answer-wait-gathering-c5cf

Conversation

@akirilyuk

Copy link
Copy Markdown
Contributor

Summary

Production relay-only runners need a=candidate (especially typ relay) in the SDP answer because the Node client does not trickle ICE candidates on the production signaling path. This adds an explicit iceAnswerPolicy on WebRtcRuntime:

  • Browser (default): trickle-immediate — send the answer right after setLocalDescription; keep the existing Chrome gather race behavior.
  • Node (createNodeWebRtcRuntime): wait-gathering — await gatheringComplete() (node-webrtc-rust) or waitForIceGatheringComplete fallback, then send a plain { type, sdp: string } answer.

Also hardens onicecandidate serialization so a bad toJSON cannot silently drop trickle frames.

Test plan

Verified locally: npm test, npm run typecheck, npm run build (all exit 0).

Node runtime sets iceAnswerPolicy wait-gathering so relay candidates are
embedded in the SDP answer via gatheringComplete. Browser keeps
trickle-immediate; answer SDP is serialized as plain { type, sdp }.
@akirilyuk
akirilyuk merged commit be7f4e6 into main Aug 14, 2026
8 checks passed
@akirilyuk
akirilyuk deleted the cursor/node-ice-answer-wait-gathering-c5cf branch August 14, 2026 22:27
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