libp2p / js-libp2p

The JavaScript Implementation of libp2p networking stack.
https://libp2p.io
Other
2.29k stars 438 forks source link

Circuit relay drops connection after minute. #2413

Closed sleep9 closed 7 months ago

sleep9 commented 7 months ago

Severity:

Medium

Description:

Peer A discovers peer B through circuit relay public server however connection to circuit relay is dropped after 2 minutes and can no longer send Peer A messages. Is this the expected behaviour ie. nodes are expected to connect directly? I am using websockets so there may be no way to get around NAT unless upgrading to webTransport which is dial only currently.

achingbrain commented 7 months ago

This is the expected behaviour. All (non-browser) libp2p nodes are Circuit Relay V2 servers by default - connections are time and data limited to prevent them from being (ab)used as open relays.

Two peers can make a direct connection using WebRTC which is supported on all platforms - they just use a relay server to do the initial connection negotiation.