Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: WebRTC-Direct support for Node.js #2583

Merged
merged 28 commits into from
Feb 12, 2025
Merged

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Jun 7, 2024

@xicilion
Copy link

I read the code a bit, in this implementation when Peer B listens, it first listens for incoming stun packets using dgram, extracts the ufrag, and then establishes a connection with Peer A from another port. This works fine in a direct network connection.
But if Peer A is behind NAT, this type of connection will fail because the NAT detects incoming packets from another port, which was not accessed from inside before.

@achingbrain
Copy link
Member Author

I haven't got to the point of testing NAT traversal yet, still a lot of PRs to land in the deps.

I was wondering if each RTCPeerConnection could negotiate it's own NAT traversal via STUN/TURN but it would probably be less resource intensive to have UDPMUX on a single port, I agree.

@xicilion
Copy link

xicilion commented Jun 12, 2024

I was wondering if each RTCPeerConnection could negotiate it's own NAT traversal via STUN/TURN.

From the logic of the code, even though multiple RTCPeerConnections share a single UDP socket in UDPMUX mode, each of them manages their own status separately and there is no difference compared to regular RTCPeerConnections. This means that the negotiation process for them is also no different from regular RTCPeerConnections.

@achingbrain achingbrain marked this pull request as ready for review February 10, 2025 13:42
@achingbrain achingbrain requested a review from a team as a code owner February 10, 2025 13:42
@achingbrain
Copy link
Member Author

I have forked node-datachannel as @ipshipyard/node-datachannel with all of the above patches applied.

Now CI is passing I'm going to merge this to allow further experimentation.

@achingbrain achingbrain merged commit 200c2bd into main Feb 12, 2025
32 checks passed
@achingbrain achingbrain deleted the feat/webrtc-direct-in-node-js branch February 12, 2025 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants