lemunozm / message-io

Fast and easy-to-use event-driven network library.
Apache License 2.0
1.11k stars 74 forks source link

How to dynamic switch discovery-server? #104

Closed takkuumi closed 3 years ago

takkuumi commented 3 years ago

New message-io user, thanks for this useful crate.

I don't know how to dynamic switch discovery-server if it goes down, Is there a way to do it?

Like this:

                    DS1 ---------- DS2
                      /\ 
                     /   \
                   /       \
                 /           \
     participant1 participant2 ...

If DS1 goes down, i want to all the participants switch to DS2.

lemunozm commented 3 years ago

Hi @NateLing

It depends on how your application works. What is exactly your problem? how to detect the server goes down once it is discovered by UDP multicast? If you discover a server, you probably then connect with the server by:

lemunozm commented 3 years ago

In these network topologies, you usually use two sockets, one to discover, and another one to "talk" with the server. The second one can connect with the server using the information that the first one provides (ip, port, credentials...).

Maybe the confusion comes from this.

takkuumi commented 3 years ago

Sorry, i forgot this. i should handle the Disconnected event. if the current discovery-server was down, switch participant to the backup discovery-server. thanks.

lemunozm commented 3 years ago

I close the issue, feel free to reopen it