Skip to content

Comment on Peerfetch – Peer-to-Peer HTTP over WebRTC

Comments

Is there a way to do this without the signaling server?

Webtorrent

Use a free signalling server from the webtorrent community. You can skip the torrent part of the implementation and just use the signalling, it's awesome. You can use a libraries like:

https://github.com/webtorrent/bittorrent-tracker

https://github.com/subins2000/p2pt

to get started. For me, I found the protocol is simple enough where I just use small vanilla javascipt implementation to talk to the websocket servers to generate the signalling messages. I wish more people knew about this and realize how easy it can be to bring WebRTC to their applications.

List of some free webtorrent trackers:

  wss://tracker.openwebtorrent.com
  wss://tracker.files.fm:7073
  wss://tracker.webtorrent.dev
---> Usage stats for the last one: https://tracker.webtorrent.dev

Some free stun servers for NAT traversal:

  stun:stun.cloudflare.com
  stun:stun.l.google.com:19302

This is super cool and almost makes it possible building PWAs that only need a dumb http server to deliver the app as a bunch of static files and still allow users to synchronize data between their devices. It still depends on the tracker but if the user could change the tracker it sounds like it's currently the best way to get clients to communicate with each other without depending on a server provided by the PWA.

Thank you for this! I knew this shit was done by someone already and I've spent two years resisting the urge to re-invent this wheel. p2pt is exactly what I knew was possible and have been looking for!

I think the closest you might get is something like the bittorrent dht. There are still bootstrap servers for the first few connections, but there's really no getting away from that, right?

https://github.com/webtorrent/bittorrent-dht

Not with the three major browsers and NAT unfortunately.

https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/...

check out NAT hole-punching in libp2p: https://docs.libp2p.io/concepts/nat/hole-punching/

scroll down a bit for the STUNless/TURNless bit

You might be interested in my side project Trystero https://github.com/dmotz/trystero

It abstracts away the work of signaling and connects peers via open decentralized networks like BitTorrent, Nostr, MQTT, IPFS, etc.

Not had time to read through the docs properly, but would this work for CLI apps (Node compiled to an executable?) or similar?

The problems this solves look interesting for a few CLI tools I want to build :)

I am also curious about the progress on this feature: https://github.com/dmotz/trystero/issues/24 for more info

Yep! If you do one non-browser WebRTC agents https://github.com/pion/offline-browser-communication

This could be possible browser to browser! I don’t think that has ever been an official use case

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.