Closed BaptisteHubert closed 1 year ago
I'm still blocked by this problem, would you have any pointer as to how to solve this @achingbrain ?
I've done a little digging into this, it looks like we receive an error event when the signalling server goes away, which then causes us to close the listener and tear down the connections.
It should be more fault tolerant - if the signalling server disconnects the listener should:
a) try to reconnect b) error we try to dial a new peer before reconnecting succeeds c) not cause existing connections to be closed
:tada: This issue has been resolved in version @libp2p/webrtc-star-signalling-server-v2.0.4 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version @libp2p/webrtc-star-v3.0.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Version of libp2p:
0.37.3
Version of webrtc-star:
3.0.0
Platform: Windows [10 - 10.0.19044](callto:10 - 10.0.19044) Build 19044 and Chrome and Opera (respectively
v103.0.5060.66
and88.0.4412.53
)Severity: High
Description:
We are trying to create a peer-to-peer web application using libp2p to enable browsers to communicate. As such, we used the example named libp2p-in-the-browser as a starting point. In this example, peers discover and connect to each others using provided webrtc-star signalling servers and bootstrap nodes.
In order to setup our own network, we use our own webrtc-star signalling server and do not use bootstrap nodes anymore. In this configuration, we discovered that peers get disconnected if the signalling server is shutdown afterward.
Following what is explained regarding the network topology in this issue, we thought that browsers were communicating directly with each others using webrtc channels once the network is setup. As such, we thought that the webrtc-star signalling server was not required anymore once peers were connected.
We were able to reproduce this issue with the latest versions of libp2p and webrtc-star.
In order to find potential issues in our code, we tried projects from the community, notably https://github.com/svdo/js-libp2p-example-chat-in-the-browser. This project used former versions of libp2p (0.27.7) and webrtc-star (0.17.3). We edited its code to use our own signalling server and disable discovery using bootstrap nodes. This time, nodes were still connected and able to communicate when we shutdown the signalling server.
It thus appears that some changes from these versions to nowadays made the signalling server the center and the single point of failure of the network topology.
Steps to reproduce the error:
The following repository provides the code and instructions to reproduce the issue: https://github.com/BaptisteHubert/libp2p-webrtc-star-issue.