holepunchto / hyperswarm

A distributed networking stack for connecting peers.
https://docs.holepunch.to
MIT License
1.04k stars 84 forks source link

Autoconnect flag #37

Closed RangerMauve closed 4 years ago

RangerMauve commented 4 years ago

It'd be nice to be able to disable the auto-connection feature for cases where it'd be handy to control that at the application level.

mafintosh commented 4 years ago

You can do that today using the info object. I think the method is info.reconnect(false)

RangerMauve commented 4 years ago

How do I get the info object from a swarm instance?

RangerMauve commented 4 years ago

Oh, I think I get it. When I get the peer event, that's where I'd invoke info.reconnect(false) which would prevent the initial connection?

indutny commented 4 years ago

Except that you don't have info in peer event :joy:

mafintosh commented 4 years ago

@indutny ah you wanna configure peer stuff before a connection happens?

indutny commented 4 years ago

I probably don't. Was just browsing through the issues to see if there is anything useful for my case.

mafintosh commented 4 years ago

you use the companion object next to the connection in the 'connection' event to manage all this