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: add node.js/electron support for webrtc transport #1905

Merged
merged 8 commits into from
Jul 31, 2023

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Jul 28, 2023

Uses node-datachannel to add support for node.js and electron (main process) to @libp2p/webrtc.

Supports:

  • Dialing private-to-private
  • Listening private-to-private

Does not support:

  • Dialing private-to-public
  • Listening private-to-public

…rivate-to-public)

Uses [node-datachannel](https://www.npmjs.com/package/node-datachannel) to
adds support for node.js to @libp2p/webrtc.

Supports:

- Dialing private-to-private
- Listening private-to-private
- Dialing private-to-public

Does not support:

- Listening private-to-public
@achingbrain achingbrain changed the title feat: add node.js/electron support for webrtc private-to-private and private-to-public feat: add node.js/electron support for webrtc transport Jul 28, 2023
@achingbrain achingbrain requested a review from maschad July 28, 2023 18:26
Copy link
Member

@maschad maschad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this! I left some comments.

@BigLep
Copy link
Contributor

BigLep commented Jul 31, 2023

@achingbrain : Thanks! Will there be a corresponding PR to add this to test-plans/interop?

@BigLep
Copy link
Contributor

BigLep commented Jul 31, 2023

@maschad
Copy link
Member

maschad commented Jul 31, 2023

@achingbrain : Thanks! Will there be a corresponding PR to add this to test-plans/interop?

Currently we have removed the webRTC tests from interop due to libp2p/test-plans#235 - which I will be resuming work on this week. Once that is resolved we can add this to suite and re-introduce the tests.

Copy link
Member

@maschad maschad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! There's some follow up work to be done given that murat-dogan/node-datachannel#171 is merged, once v0.4.4 is released.

@maschad maschad merged commit 72e81dc into master Jul 31, 2023
16 checks passed
@maschad maschad deleted the feat/add-node-support-for-webrtc-transport branch July 31, 2023 15:50
@p-shahi
Copy link
Member

p-shahi commented Aug 1, 2023

@AustinFoss
Copy link

I came across this while trying to figure out why my nodejs node wasn't advertising a webRTCDirect listening multiaddr. Spent too much time before learning webRTC wasn't supported in node, just the browser so far.

But I'm curious about your statements "Listening private-to-private" & "Listening private-to-public", does this mean a public node can't listen on "/ip4/0.0.0.0/udp/0/webrtc-direct" even with this branch's solution?

@achingbrain
Copy link
Member Author

No, this PR only adds support for private WebRTC addresses (e.g. the SDP handshake needs to take place via a relay server).

It should be possible to support this in future, I've opened a draft PR here but we need some features adding to the underlying libraries.

@Sotatek-HocNguyena
Copy link

@achingbrain Does it support private (nodejs) - private (browser)? I'm trying but can't connect webrtc between nodejs (private) and browser through relay

This was referenced Jan 18, 2024
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.

6 participants