deps(transport-webrtc): replace node-datachannel#3544
Conversation
|
Thanks @mertushka for putting this together. I’m hesitant to merge this right now because the replacement dependency is still very new and hasn’t had much time to prove itself in production or across the ecosystem. For a core dependency like this, I’d prefer we wait until it has more adoption, a clearer maintenance track record, and some time for early issues to shake out. This isn’t a rejection of the approach, but I don’t think we should take on that risk in js-libp2p yet. Happy to revisit once the dependency has matured a bit. |
|
@dozyio Thanks for the feedback, that makes sense and I agree with the concern. I opened this PR mostly to share the idea and start a discussion rather than to push for an immediate merge. The main reasons I explored replacing I originally built the module because one of my own projects, haxball.js, had several issues with That said, I completely understand that js-libp2p needs to be conservative with core dependencies. I’m happy for this PR to stay as an experiment/reference. |
|
Moving to draft as likely won't be merged in the near term |
Description
Replaces
node-datachannelwith @mertushka/webrtc-node in@libp2p/webrtc.@mertushka/webrtc-nodeis a Node.js WebRTC binding that exposes a W3C-compatible WebRTC API surface instead of a package-specific polyfill surface. Version0.2.0passes 620 strict Web Platform Tests for WebRTC API behavior and provides the standard objects@libp2p/webrtcalready uses in browsers, includingRTCPeerConnection,RTCDataChannel,RTCSessionDescription,RTCIceCandidate,RTCCertificate, and standardEventTargetbehavior.This is useful here because the existing Node path had to wrap
node-datachannelAPIs to inject ICE credentials, map ICE servers, import certificates, work around stale data channel state, and force native peer connection cleanup. With@mertushka/webrtc-node, the Node path can use the standard WebRTC-shaped APIs directly, with explicitnonstandardhooks only where WebRTC Direct needs Node-specific control over ICE credentials, certificate import, UDP muxing, fingerprint verification, and remote fingerprint access.This removes the node-datachannel-specific compatibility layer and related runtime workarounds now that the replacement exposes the required standard WebRTC APIs plus the nonstandard APIs used by the WebRTC Direct path.
Changes include:
node-datachanneldependency with@mertushka/webrtc-nodenonstandardAPIs:configurePeerConnectionimportCertificatesetLocalIceCredentialsgetRemoteFingerprintIceUdpMuxListenerRelated open PRs
Potentially Fixes/Closes:
Likely requires a rebase:
Verification
npm run dep-check -w @libp2p/webrtcnpm run build -w @libp2p/webrtcnpm run test:node -w @libp2p/webrtc -- --exitnpm run test:chrome -w @libp2p/webrtc