-
Notifications
You must be signed in to change notification settings - Fork 168
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
Reconnect option #235
Comments
Hi, any input on this? Thank you! |
Do you mean the client process which version are you using? latest version need a retry number like {reconnect, 1000} %% give up after 1000 reconnects. |
Thank you for your reply. It seems the process exits. I'm using emqtt 1.11.0, git ref c815a18. I'm now using your suggestion of setting the reconnect option to 1000. Is the value 'true' still allowed, and does that imply that it will keep trying? It's an Elixir/Phoenix project. You can see the code at: The settings are in: The module that uses emqtt is at: |
I think we change it to Do you mean after set it to |
Yes. |
I am testing a branch here #238 which just make
I cannot reproduce the issue you found even I set reconnect to 1 I get different error
Your debug log will be appreciated. |
I think what happens is that I'm using publish() to send data. If the connection is down, this seems to hang. Any other call to my GenServer then also hangs. Any other call to my GenServer then also times out. Is publish() expected to time out at some point if the connection is down? I guess I should try to use pubish_async(). |
Thank you for the answer, I will close the issue. Reconnect works as expected in my app. Although I still wish it will also work during the initial connection: #104. |
#149 mentions the {reconnect: true} option. This reconnect option seems to be missing from the documentation in the Readme?
I'm trying to use it, but it doesn't seem to reconnect.
I pass {reconnect: true} as part of the options when calling start_link() and emqtt starts normally. I'm connecting to emqx running locally in a docker container. I can now publish and subscribe to messages.
If I stop the emqx broker, then emqtt does not immediately report any error, even after waiting for several minutes. But if try to publish data, i get
[error] shutdown: :econnrefused
, and my gen_server dies. This is similar to what happens if the broker is unavailable when I start emqtt.I would expect emqtt to reconnect, instead of dying?
The text was updated successfully, but these errors were encountered: