Peers disconnect every 10 minutes

I’ve been trying to resolve this issue for a while, and can’t seem to make any progress, so I figured I’d ask.

I’ve been working on a program in the node js implementation of IPFS, and have noticed that about 10 minutes after the two peers connect, and start communicating, they disconnect. I’ve on occasion been able to use the disconnect event to tell the swarm to reconnect the peers, I’d like to find a better solution–especially as this does not work well.

I’ve tried changing discovery settings, had the peers actively communicating and had the peers not communicating at all, and still they disconnected.

As this is my first post, I don’t exactly know what information would be the most helpful, but here’s some of the configuration in one of the peer’s repo:

"Addresses": {
"Swarm": [
  "/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star",
  "/ip4/0.0.0.0/tcp/4002",
  "/ip4/127.0.0.1/tcp/4003/ws"
],
"API": "/ip4/127.0.0.1/tcp/5001",
"Gateway": "/ip4/127.0.0.1/tcp/9090",
"Delegates": []
},
"Discovery": {
"MDNS": {
  "Enabled": true,
  "Interval": 10
},
"webRTCStar": {
  "Enabled": true
}
},
"Bootstrap": [
"/p2p-circuit/ipfs/Qm..." //This is the ID of the peer that I want to connect to 
]

I suppose its also worth noting, that I don’t see any errors when this occurs. It appears to just happen.

What version of js-ipfs are you using?

If the connections are idle this could be a connection timeout closing the connection. It might be worth adding an interval ping to see if that resolves the problem.

We dont have any keepalive functionality in js-libp2p yet, we may look at adding this for the js-libp2p 0.30 release.

1 Like