RangerMauve / hyperswarm-universal-chat

A basic demo showing how you can make a gossip based p2p chat using hyperswarm.
MIT License
29 stars 0 forks source link

Inconsistent connections when more than 2 peers #2

Closed draeder closed 2 years ago

draeder commented 2 years ago

I have been experimenting with this implementation and I'm finding connection inconsistency when there are more than 2 peers. My testing has mostly been locally using different browsers / browser tabs. But this occurs between different devices as well.

As an example, I open a tab on my iPad in Safari(A), then on my Mac in Chrome (B), then on my Mac in Safari (C). Communication only works as follows:

Works: A <---> B B <---> C

Doesn't work: A <-x-> C C <-x-> A

I've used hyperswarm and never had issues like this between peers. Is this some kind of limitation with hyperswarm-web? Or is this a limitation of this particular library? Or am I doing something wrong?

RangerMauve commented 2 years ago

In browsers it acutally isn't Hyperswarm that does connections, but the underlying WebRTC connection provided by your browser.

One thing you could do to improve reliability is to add a TURN server to the hyperswar-web settings. This should enable connecting people via a tunneling server when they can't connect directly. Sadly WebRTC isn't as capable as native hyperswarm when it comes to connecting devices together. 😅

draeder commented 2 years ago

Thanks - I've actually been working on a hyperswarm & webrtc implementation using simple-peer. Experimenting with this library was part my homework for that.

RangerMauve commented 2 years ago

Nice, hyperswarm-web actually uses simple-peer under the hood. 😁