Comments (5)
(maybe) supporting longpoll
In my opinion this has little relation to async
/.await
, so please open a separate issue for supporting long polling.
getting moved to async/.await
I am certainly not against it!
The reason vk-bot
is currently synchronous is as follows:
- Initially,
rvk
was asynchronous (long beforeasync
/.await
). - Then I changed it to be synchronous in
v0.2.0
for some reason that I'm not entirely sure about now 😅. - After some time I created
vk-bot
, and decided to go for synchronous as well (async
/.await
was also not a thing in Rust yet).
So for making it async
/.await
, the following needs to be done, I think (do correct me if I'm wrong somewhere):
-
Transition
rvk
to useasync
/.await
. While this is likely not strictly required I guess, it'd certainly be nice for essentially the "backend" ofvk-bot
to be asynchronous as well in the first place.This should be relatively straightforward, most actual changes would be in
api.rs
:- Choose a library to use. I think
surf
is a great option right now? APIClient
should store some sort of aClient
if such thing is needed/exists in the chosen library.call_method
should be madeasync
and use that library to call API methods.
- Choose a library to use. I think
-
Release a new (major) version of
rvk
. -
Close Dependabot's PR attempt to migrate
vk-bot
to that version as it should fail, if I understand correctly. -
Change
vk-bot
to use the new version ofrvk
.A little bit more involved than step 1: while it should be straightforward theoretically, I'm not exactly sure how well/simply that'd work with Rocket. Anything mentioning API calls would probably need to be changed initially, and then
rustc
is your best friend, as always 😉. -
Release a new (major) version of
vk-bot
.
I'd love it and can help with it.
Awesome! Then I think you can start by opening a PR on rvk
with the needed changes (also feel free to open a draft PR right away if you want).
from vk-bot.
The first and second parts are ready I think 😄
But I'm a bit unsure about rocket because it supports async/.await only in git's version. What's about moving to any other framework or ...?
from vk-bot.
Ok, so awaitlink/rvk#9 is merged now. As far as I understand, you'd like to change some other things in rvk
as well.
So we could either:
- Release new
rvk
version now and proceed with other changes to getasync
/.await
support first, and then do the other improvements after that is done. - Or I will wait for your changes, and then we'll proceed on
async
/.await
.
Personally, I think 1 is a better option. Do you have any preference?
But I'm a bit unsure about rocket because it supports async/.await only in git's version. What's about moving to any other framework or ...?
Hmm. Ideally I'd like to not change that... but I see that Rocket's async is still in progress, yes. The good news is that there are just a handful of HTTP requests that need to be handled, so switching shouldn't be that complex.
Do you have any preferred alternatives in mind? From my quick look warp
looks good enough for vk-bot
's purposes.
from vk-bot.
Yeah, I think warp is ok for this. I choose the second option. I'll write here when rvk
is ready.
from vk-bot.
Ok, I think rvk is ready! I'll add async/.await
support for vk-bot
in next PR. Also I want to extend the features of vk-bot
and release async/.await
with them 😄
from vk-bot.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vk-bot.