Webrtc-star : Connection closed

Hello,

By using libp2p-webrtc-star (V0.25), I am unable to reach the star-signal launched on a server, I have the failed: Connection closed before receiving a handshake response.

My client code works well with the /dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star/p2p/MYIDso the client setup seems fine.

I launch star-signal on server with the default setup : star-signal --port=9090 --host=0.0.0.0
A port scanning (nmap) from my client shows it works : 9090/tcp open
I try to reach it thanks to the following listen setup : /ip4/xx.xx.xx.xx/tcp/9090/ws/p2p-webrtc-star/p2p/MYID`

But the client is unable to connect using libp2p(V0.36.2) :
websocket.js:54 WebSocket connection to 'ws://xx.xx.xx.xx:9090/socket.io-next/?EIO=4&transport=websocket' failed: Connection closed before receiving a handshake response

I’ve tried also with a websocket client, and a call to ws://xx.xx.xx.xx:9090/socket.io-next/?EIO=4&transport=websocket answers also connection closed…

At this step, I don’t understand why. Any help ?
thanks.

By following github js-libp2p-websocket-star

I have updated the server with npm install --global libp2p-websocket-star-rendezvous
And launched it : rendezvous --port=9090 --host=0.0.0.0
with node V10.15.2

Same problem.

Here is my client setup :

      state.node = await Libp2p.create({
        peerId: state.peerId,
        addresses: {
          listen: [
            '/ip4/0.0.0.0/tcp/0',
            `/ip4/xx.xx.xx.xx/tcp/9090/ws/p2p-webrtc-star/p2p/${state.peerId.toB58String()}`,
            // `/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star/p2p/${state.peerId.toB58String()}`
          ],
        },
        modules: {
          transport: [
            TCP,
            WebRTCStar,
          ],
          discovery: [
            WebRTCStar.discovery
          ],
          streamMuxer: [Mplex],
          connEncryption: [SECIO],
          peerDiscovery: [MulticastDNS],
          pubsub: Gossipsub,
        },
        config: {
          peerDiscovery: {
            autoDial: true,
            mdns: {
              interval: 1000,
              enabled: true,
            },
            webRTCStar: {
              enabled: true,
            },
          },
          pubsub: {
            enabled: true,
            emitSelf: false,
            signMessages: true,
          },
        },
      });

Hello @olivier

The websocket-star module and server is deprecated: GitHub - libp2p/js-libp2p-websocket-star: libp2p-webrtc-star without webrtc. Just plain socket.io.

You should be looking into webrtc-star server js-libp2p-webrtc-star/packages/webrtc-star-signalling-server at master · libp2p/js-libp2p-webrtc-star · GitHub

Ouch, my bad. You’re right, I’ve commented with a bad link, as I don’t use websocket-star module, but only webrtc-star.

I have followed the webrtc-star page to remove star-signal and install webrtc-star, and you’re right : it works now. Thanks a lot for the help. I think the problem was a too old webrtc-star server.

To understand better, now I have this in the console :

neo:p2p-store peer disconnected Qmap1pQmhA3hWrVZ3uxigVfbFaB2VxhXnWUMtcPTrnQfrw +7m
common.js:113 
neo:p2p-store peer connected Qmap1pQmhA3hWrVZ3uxigVfbFaB2VxhXnWUMtcPTrnQfrw +1m
common.js:113 
neo:p2p-store peer disconnected Qmap1pQmhA3hWrVZ3uxigVfbFaB2VxhXnWUMtcPTrnQfrw +47ms
common.js:113 
neo:p2p-store peer connected Qmap1pQmhA3hWrVZ3uxigVfbFaB2VxhXnWUMtcPTrnQfrw +8s

Is it normal peers get connected/disconnected this way ? Just to know if I have to do further debugging.

Thanks.