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

[Question]: Suggested initialization flow #150

Closed
fuatakgun opened this issue Nov 12, 2022 · 8 comments
Closed

[Question]: Suggested initialization flow #150

fuatakgun opened this issue Nov 12, 2022 · 8 comments
Labels
question Further information is requested

Comments

@fuatakgun
Copy link
Contributor

Ask your question

before moving forward, thanks again for your great work.

This might be a late question to ask, after couple of months but it is better than never :)
What could be the best optimal way of initializing the communication between WS and external consumers.
Currently, I am following this path;

  • create a WS client connection with docker instance
  • send start listening message. (I always thought this is required at the beginning so we can get response from any WS call, moreover, it is an easy way to dump all the information about devices and stations)
  • send set api schema message
  • send driver.connect message
  • if driver is NOT connected, check if captcha (probably same flow for 2FA?) required would change into True and ask user to enter captcha.
  • if driver is still NOT connected (should be), check if captcha required is already True and if user had put captcha code, if all true, send set captcha command and send start_listening command.
  • if driver is connected, captcha (probabaly 2fa) is not required and start_listening would probably return all devices information, continue with setting up internal state.

I need guidance around initial flow, currently, my implementation seems to be very complex and interested to fix it.

@fuatakgun fuatakgun added the question Further information is requested label Nov 12, 2022
@bropat
Copy link
Owner

bropat commented Nov 12, 2022

  1. create a WS client connection with docker instance
  2. set api schema
  3. start listening
  4. from now on you get events
  5. Listen to captcha request or verify code events
  6. If you receive one of these events, respond to it by requesting a captcha or code. Then you send the received captcha or verify code.
  7. At the latest now you should receive a connectedevent.

One more thing: You don't need to force a connection. The driver starts the connection by itself.

@fuatakgun
Copy link
Contributor Author

Got it, how can i get the whole start_listening response (with all stations and device information) after captcha or 2fa events? Should i call start_listening one more time?

@bropat
Copy link
Owner

bropat commented Nov 12, 2022

Yes

@bropat
Copy link
Owner

bropat commented Nov 12, 2022

In the next version I will also add a connection error event to the driver.

@fuatakgun
Copy link
Contributor Author

Thanks. did you find a way to force captcha on a given account? I would like to rework that part on integration but couple of accounts i owned do not ask for captcha.

@bropat
Copy link
Owner

bropat commented Nov 12, 2022

If you log into an account incorrectly several times, you will receive a captcha request. But don't overdo it, otherwise the account will be temporarily blocked.

@bropat bropat closed this as completed Nov 13, 2022
@fuatakgun
Copy link
Contributor Author

let me re-open this thread, but I can move it into a new one.
Given that ws is running independent of client;

  • ws will start and wait on captcha/code request
  • client will connect to ws and send start_listening to receive respective events.
    Given that these events are not cached, new connected client should not receive the previous generated event. I am still having issues to understand a healthy flow of initial connection.

How can client receive captcha/code events properly and respond to them?

@fuatakgun
Copy link
Contributor Author

I want to rephrase my overall problem here;

  • docker instance is running independent of any client
  • docker instance needs a client to complete captcha/code request
  • client can connect any time to docker instance but client fails to receive respective captcha/code events to handle them peacefully.
    Any help is much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants