Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Review #109 first - this is based on that.
To avoid contributing to the fragmentation of the async ecosystem, I think its really important to support both tokio and async-std. Additionally, async-std is the only runtime that has wasm support currently, and it is a personal goal of mine to get this project capable of running in the browser and communicating over web sockets (see #64).
You can control which version via feature flags, as this seemed to be the canonical approach in other projects that can use either runtime (like async-tungstenite) for example. I've left the default runtime to be tokio, as it seems to be the more popular and fully featured option.
In terms of the complexity of maintaining two versions, the two libraries present an extremely similar api. In most places, the wrappers I wrote are a drop in replacement for whatever we were using before, and you can see that with just wrappers for spawning tasks. everything else is just in how transports are implemented, and even there the code doesn't diverge much. I had to add some beginner-unfriendly cfg statements in the example code, but that is a small price to pay for being able to build all tests and examples in either version, rather than just the source code. Also, both tokio and async-std are 1.0 now, so we shouldn't need to worry to much about changing APIs.
I also now test both tokio and async std in the CI. This should ensure that our code operates on both versions.