Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect to multiple peers in case first peer is not responding #4

Open
resession opened this issue Mar 15, 2022 · 1 comment
Open

Comments

@resession
Copy link

with node.connect({host: "remote_ip", port: remote_port}) we can connect to the network with one other node, if that node goes offline, then it will not connect. would it be possible to use an Array[] and connect to multiple nodes, in case the first node does not work?

@Nephys
Copy link
Owner

Nephys commented Mar 31, 2022

node.connect can be used more than once to connect to multiple nodes, you could loop through your array of nodes and connect to each of them.

The connect function returns an event emitter that will emit a "connected" event once connected to a node otherwise a "timeout" event will be emitted if the remote node is unreachable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants