-
Notifications
You must be signed in to change notification settings - Fork 0
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
Automatically connect to grisp.io #14
Conversation
3934738
to
b548033
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a look at the comments in the code please
b548033
to
f5aded4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I am going to adjust a couple of things to solve the merge conflict with the WS refactoring then I'll squash. |
f5aded4
to
1b6d77d
Compare
The gen_statem is there to mainly automate what was previously done manually.
State machine is quite simple, is just a sequence that can loop in case it disconnects.
idle -> waiting_ip -> connecting -> connected -> waiting_ip ....
The option
{connect, true / false}
controlls whether the gen_statem should connect or not.The gen_statem is always started under the top app supervisor.
The user can either leave the default
{connect, true}
and have this process attempt to connect as soon as it is started.If
{connect, false}
is set in the sys.config, then it can always be started withgrisp_io_connection:connect()
I noticed that on Wifi WPA supplicant can be slow and the IP can take even 5+ seconds to be set after the app is booted. So if we serve logs to the user, is nice to wait for the IP instead of keep crashing on errors.