noise icon indicating copy to clipboard operation
noise copied to clipboard

Example for reconnecting to nodes if they drop out

Open pocockn opened this issue 4 years ago • 1 comments

I'm creating an application that has a node that broadcasts messages out to all the nodes that are connected to it. I'm currently using a simple approach where I get my child nodes to ping the master node so they get added to the route table and then my master node can send messages to all the connected nodes.

I'm thinking it would be nice to have an example to show how to handle the situation when my master node drops out and then the child nodes do some sort of retry until the master node comes back online.

I wanted to have a loop running and a select that listened on the client method WaitUntilReady that tells my child nodes the client connection has closed and then tries to reconnect every x seconds but I don't think WaitUntilReady returns a channel.

I'm not sure if my use case can be easily done with the current implementation, great library though.

pocockn avatar May 26 '20 14:05 pocockn

Check out lithew/monte. It's by the same author and has reconnection functionality.

johnhorsema avatar Jun 16 '20 15:06 johnhorsema