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: Built-in-webrtc #2786

Merged
merged 7 commits into from
May 23, 2024
Merged

Conversation

ThaUnknown
Copy link
Member

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[ ] Bug fix
[x] New feature
[ ] Other, please explain:

What changes did you make? (Give an overview)
webrtc is now built in, this deprecates webtorrent-hybrid
Which issue (if any) does this pull request address?

Is there anything you'd like reviewers to focus on?

Copy link

socket-security bot commented May 14, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@thaunknown/simple-peer@10.0.4 None +1 105 kB thaunknown

🚮 Removed packages: npm/@thaunknown/simple-peer@9.12.1

View full report↗︎

@ThaUnknown ThaUnknown enabled auto-merge (squash) May 23, 2024 12:56
Copy link
Member

@SilentBot1 SilentBot1 left a comment

Choose a reason for hiding this comment

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

This worked as expected on all local testing, both to https://instant.webtorrent.dev and between two NodeJS WebTorrent peers via WebRTC. This looks good to me!

@ThaUnknown ThaUnknown merged commit c693f9e into webtorrent:master May 23, 2024
6 checks passed
webtorrent-bot pushed a commit that referenced this pull request May 23, 2024
# [2.3.0](v2.2.2...v2.3.0) (2024-05-23)

### Features

* Built-in-webrtc ([#2786](#2786)) ([c693f9e](c693f9e))
@webtorrent-bot
Copy link
Collaborator

🎉 This PR is included in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@QuixThe2nd
Copy link
Contributor

Hi, I believe this breaks WebTorrent.WEBRTC_SUPPORT, as I'm on an ARM Macbook which I believe doesn't support WebTorrent, but WebTorrent.WEBRTC_SUPPORT returns as true.

@ThaUnknown
Copy link
Member Author

verify it, because an "I believe" doesn't cut it, there's no reason for it to not support webrtc

@ThaUnknown ThaUnknown deleted the built-in-webrtc branch May 24, 2024 15:37
@QuixThe2nd
Copy link
Contributor

QuixThe2nd commented May 24, 2024

I can't remember where it was being used, but I remember node-webrtc was a dependency of WebTorrent. I can't seem to find any mentions of it now, so I'm not sure where I saw this. But node-webrtc doesn't support ARM Mac's and I can't get WebRTC connections using WebTorrent on my ARM Mac.

Edit: I tried again and WebRTC is working. I'm not sure when node-webrtc was removed, but I guess it was.

@ThaUnknown
Copy link
Member Author

this doesn't use node-webrtc

@SilentBot1
Copy link
Member

SilentBot1 commented May 24, 2024

Hi, I believe this breaks WebTorrent.WEBRTC_SUPPORT, as I'm on an ARM Macbook which I believe doesn't support WebTorrent, but WebTorrent.WEBRTC_SUPPORT returns as true.

This works as expected on ARM, the new library being used for WebRTC supports ARM devices. WebTorrent.WEBRTC_SUPPORT returning true was the goal of this PR, and deprecates the need for webtorrent-hybrid for NodeJS WebRTC connectivity.

root@arm:~/webtorrent# dpkg --print-architecture
arm64
root@arm:~/webtorrent# node
Welcome to Node.js v18.17.1.
Type ".help" for more information.
> const { default: WebTorrent } = await import("webtorrent"); const client = new WebTorrent({utp: false});
(node:90473) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:90473) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
WebTorrent: uTP not supported Error: Cannot find module 'utp-native'
[...]
undefined
> const torrent = client.add("magnet:?xt=urn:btih:4c52086259fb7b77bbccc4b4b44f88759c6a9ef7&dn=100MB.bin&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.dev&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337")
undefined
> Object.values(client.torrents[0]._peers).filter((p)=>p.type=='webrtc').length
1
> client.torrents[0].progress
0.1734375

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants