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

Added ability to specify multiple hosts to connect to #52

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

waymirec
Copy link

Added the ability to specify a list of of host and port tuples of brokers to connect to. Each host in the list will be attempted before the reconnect strategy is engaged.

Also added an "is_connected" api function that returns false if not connected and {true, {Host, Port}} when connected.

Populating the "hosts" config option with a list of {Host, Tuple} pairs
will cause emqttc to attempt to connect to each host in the list
before initiating the reconnect strategy.
If not a response of false is returned.
If it is connected a response of {true, {Host, Port}} is returned.
…er during init.

That way the connect function does not need to check whether hosts is empty but can
simply pull hosts out of it for connecting. It is guaranteed to always have at least
one entry because if it is not explicitly defined then it have the "host" and "port"
state members added to it which will always be defined.
@emqplus emqplus self-requested a review November 20, 2017 03:11
@emqplus emqplus added this to the 2.0 milestone Nov 20, 2017
@HJianBo HJianBo assigned tigercl and unassigned HJianBo Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants