saskenuba / SteamHelper-rs

Interact with Valve's Steam network with this collection of crates.
MIT License
57 stars 12 forks source link

Port steam-totp #2

Closed saskenuba closed 4 years ago

saskenuba commented 4 years ago

We can find in here a reference implementation in node.js of how the 2FA Codes are generated, but how should we deal with the API call? Ideally it should be in a non blocking way. What do you think?

Leorii commented 4 years ago

Just read through node-steam-totp. Looks like most of the functionality is derived from http calls. If we don't want it to be blocking, then we could either do the work in a different thread, or make the calls asynchronously. Do you have a preference for which method you'd prefer?

If most of these helpers do http calls for functionality, then async might be best. Reading through the async book now.

saskenuba commented 4 years ago

I believe the best way would be to go single thread async. After reading through Steamkit's code I don't think going multithread would present benefits that are worth the effort, especially only for event listening and writing messages back on a single connection. We could change our mind if after a minimal viable product is deployed, that could log in and listen to a couple of messages, we noticed increased delay or something.

On steam-API crate I added reqwest as a dependency to handle HTTP requests, and also an API module that has a builder to make calls on api.steampowered.com easier, you check if it fits for your needs, or feel free to create something else.

Leorii commented 4 years ago

Oh awesome, yeah I was just going to use reqwest for those, so I'll check the steampowered builder out.

And yeah, that sounds good. I'll start implementing it with Futures then.

saskenuba commented 4 years ago

Solved by #4.

saskenuba commented 4 years ago

missmerge, reopening.