Skip to content

Problem with peer to peer chat over WAN + LAN (help wanted) #5028

Answered by dariusc93
du82 asked this question in Q&A
Discussion options

You must be logged in to vote

Mdns would only work if your machines (and local network) supports it. Sometimes a firewall will block this and would require it to be enabled on both ends.

As for why disconnecting and reconnecting on the internet doesnt work is because the code does not attempt to dial the peer again after disconnection (assuming this is over WAN on mdns discovery event, Behaviour::add_explicit_peer is called, which would internally dial the peer if the peer isnt connected). The best solution would be retry the connection by listening on SwarmEvent::ConnectionClosed, add that peer to an array of peers and at some interval attempt to retry a connectionion to those peers and if that fails just wait for th…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by du82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants