Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upConversion to tokio 0.2 #68
Conversation
This comment has been minimized.
This comment has been minimized.
|
currently hung up on tokio-dns, looks like the future it returns isn't correct, |
This comment has been minimized.
This comment has been minimized.
|
Have you filed an issue at tokio-dns to resolve the blocker? |
This comment has been minimized.
This comment has been minimized.
|
Master has the required updates, so using that to keep moving forward.
…On Tue, Sep 10, 2019, 7:07 AM Naja Melan ***@***.***> wrote:
Have you filed an issue at tokio-dns to resolve the blocker?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#68?email_source=notifications&email_token=AALIKFGWLR6I3CVQD2WTRKLQI6L2TA5CNFSM4IVBHKW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6LAOPA#issuecomment-529925948>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALIKFEKHTFMHI4M7MJYOK3QI6L2TANCNFSM4IVBHKWQ>
.
|
|
Just asking some questions, I haven't fully reviewed everything. I do feel this lacks integration testing, verifying every possible scenario, but then again, tokio-tungstenite didn't have those before either. |
This comment has been minimized.
This comment has been minimized.
Will look at add at least a couple more once I get something that seems like it might work. |
This comment has been minimized.
This comment has been minimized.
|
@najamelan @application-developer-DA Everything compiling, existing tests passing. Examples upgraded as well. Will be seeing what I can come up with for tests. |
This comment has been minimized.
This comment has been minimized.
CryZe
commented
Sep 15, 2019
•
|
This doesn't build without the tls feature. In particular here: https://github.com/dbcfd/tungstenite-rs/blob/expose-machine/src/client.rs#L49
|
This comment has been minimized.
This comment has been minimized.
|
@CryZe This was actually an issue in tungstenite and is fixed in snapview/tungstenite-rs#73. cargo update and this branch should build now. |
This comment has been minimized.
This comment has been minimized.
CryZe
commented
Sep 16, 2019
•
|
Nice, another issue I ran into was that the pin-project |
This comment has been minimized.
This comment has been minimized.
|
Matching hyper for now, since one of the reasons for this work was to use it in warp. |
This comment has been minimized.
This comment has been minimized.
CryZe
commented
Sep 16, 2019
|
If I'm sending two messages before trying to receive any I get:
|
This comment has been minimized.
This comment has been minimized.
|
@CryZe Added a test which reproduces this behavior, attempting to determine cause and fix it. |
This comment has been minimized.
This comment has been minimized.
|
The multiple write failure is due to tungstenite write_message calling flush. This means that Sink cannot be used for send, since it does not include a context. |
This comment has been minimized.
This comment has been minimized.
CryZe
commented
Sep 20, 2019
|
That seems to have fixed the bug for me :) |
This comment has been minimized.
This comment has been minimized.
CryZe
commented
Sep 23, 2019
•
|
Is there a reason this doesn't use Sink for sending messages? |
This comment has been minimized.
This comment has been minimized.
|
@CryZe Sink cannot be used because tungstenite write_message is also calling flush. Sink write does not provide a context, so no context is present when write_message then calls flush. One possibility is to separate the the write and flush into separate functions in tungstenite (that write_message uses), so then we could implement Sink in tokio-tungstenite. |
This comment has been minimized.
This comment has been minimized.
dbrgn
commented
Oct 1, 2019
|
Async/await is now available on Beta, so we don't even need nightly anymore! https://blog.rust-lang.org/2019/09/30/Async-await-hits-beta.html |
This comment has been minimized.
This comment has been minimized.
CryZe
commented
Oct 2, 2019
•
|
Yeah looks like tokio and futures have released versions that are compatible with the beta, so I'd appreciate if this PR would be updated to those versions as well. I did the changes locally here: CryZe@d4e5872 |
This comment has been minimized.
This comment has been minimized.
cere42
commented
Oct 8, 2019
|
Just wanted to say I'm pretty excited about this PR, I've been trying the most recent version out for a side project the last few days. It's just very smooth integration, I'd say currently this is shaping up to become the go-to for anyone building a websocket based application using async/await. The only issue I've noticed so far is due to not implementing |
This comment has been minimized.
This comment has been minimized.
anlumo
commented
Oct 8, 2019
|
Can someone point me to a way to read and write to the same Websocket with this implementation without |
This comment has been minimized.
This comment has been minimized.
|
It is doable via |
This comment has been minimized.
This comment has been minimized.
anlumo
commented
Oct 8, 2019
•
|
I just discovered that it does work when I remove my call to I also can't use Seems like this is one of the applications where the |
This comment has been minimized.
This comment has been minimized.
|
@skaufhold I will look about adding a split method to this, so that Sink is not required. @anlumo It will look something like this
You can also do something like
The examples (especially autobahn) show this off better https://github.com/snapview/tokio-tungstenite/pull/68/files#diff-9da84c2001004ed41d861e7b1fc0850fR37 |
This comment has been minimized.
This comment has been minimized.
mcseemk
commented
Oct 8, 2019
I use the following workaround: let (mut ws_stream, _) = match connect_async(...).await {
Ok(x) => x,
Err(e) => {}
};
let mut heartbeat = Interval::new(Duration::from_secs(3));
'inner: loop {
let either1 = select(receive_channel.next(), select(heartbeat.next(), ws_stream.next())).await;
match either1 {
Either::Left((msg, _)) => {
// received message via channel, process it
}
Either::Right((either2, _)) => {
match either2 {
Either::Left(_) => {
// heartbeat, do whatever
}
Either::Right((msg, _)) => {
// websocket message received, process it
}
}
}
}
} |
This comment has been minimized.
This comment has been minimized.
|
Hello @dbcfd , I'm fiddling with the server and client examples. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
CryZe
commented
Dec 10, 2019
|
What's the status of this? |
This comment has been minimized.
This comment has been minimized.
bstrie
commented
Dec 10, 2019
|
I believe that the acceptance of this PR was blocked on the next stable hyper release? That's just happened ( https://seanmonstar.com/post/189594157852/hyper-v013 ), so are there any remaining issues here? |
This comment has been minimized.
This comment has been minimized.
|
@bstrie Nope :D |
This comment has been minimized.
This comment has been minimized.
|
@application-developer-DA ready for review/merge |
| @@ -21,7 +21,7 @@ stream = [] | |||
| log = "0.4" | |||
| futures = "0.3" | |||
| pin-project = "0.4" | |||
| tokio = "0.2" | |||
| tokio = { version = "0.2", default-features = false, features = ["io-util"] } | |||
This comment has been minimized.
This comment has been minimized.
bstrie
Dec 12, 2019
Nit, but tokio's Cargo.toml has:
# Include nothing by default
default = []
so default-features = false is a no-op.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@application-developer-DA Any chance this could be merged ASAP? |
This comment has been minimized.
This comment has been minimized.
|
What, if anything, could be done to progress this? |
This comment has been minimized.
This comment has been minimized.
bstrie
commented
Dec 23, 2019
|
I would suspect that the maintainers are reasonably predisposed during the holidays, although I suppose it wouldn't hurt to ping @agalakhov as well. |
This comment has been minimized.
This comment has been minimized.
|
I'll check this during the holidays. |
This comment has been minimized.
This comment has been minimized.
|
NB: The "chat server" was missing in the |
This comment has been minimized.
This comment has been minimized.
|
@application-developer-DA while examples are definitely important, I strongly suggest merging this as is if it works. There is too much downstream blocked from upgrading to Tokio 0.2 because this PR has not been merged yet. |
This comment has been minimized.
This comment has been minimized.
|
Checked this partially. This pull request requires more cleanup to be merged. I'm working on it. Sorry, it can't be merged in its current state. |
This comment has been minimized.
This comment has been minimized.
|
@agalakhov If it's in the working state it could be possible to merge as is and keep iterating in subsequent commits. You can slap an |
This comment has been minimized.
This comment has been minimized.
|
I have to check for some potential security and stability issues first. Especially handshake code has to be carefully checked. Now it is much better than initially (no more |
This comment has been minimized.
This comment has been minimized.
|
Ok, I checked this. While |
dbcfd commentedSep 9, 2019
Convert to tokio 0.2