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

Websocket: second message got delayed if client sends two messages to server simultaneously. #27

Closed
xudesheng opened this issue Aug 31, 2020 · 1 comment

Comments

@xudesheng
Copy link

xudesheng commented Aug 31, 2020

when WebSocket's client sends two messages simultaneously, the second message would got delayed.
How to reproduce, use: examples/websocket/client
original code(line 55-58):

        // send text to server
        if futures::executor::block_on(tx2.send(ws::Message::Text(cmd))).is_err() {
            return;
        }

replace it with new demo code:

       // send text to server
        let cmdback=cmd.clone();
        if futures::executor::block_on(tx2.send(ws::Message::Text(cmd))).is_err() {
            return;
        }
        if cmdback=="test\n"{
            println!("We are going to send second one...");
            let cmd = format!("No more test!\n");
            if futures::executor::block_on(tx2.send(ws::Message::Text(cmd))).is_err() {
                return;
            }
        }

Expected Result:
If I enter "test", then it should print two lines: one is "test" and another one is "No more test!".

Actual result:
The line for "No more test!" would only be printed when the client receives a Ping from the server or you enter next.

demo
Server: b"demo\n"
test
We are going to send second one...
Server: b"test\n"
Got server ping: b""
Server: b"No more test!\n"
test
We are going to send second one...
Got server ping: b""
Server: b"test\n"
demo
Server: b"No more test!\n"
test
We are going to send second one...
demo

Not sure this issue is similar to issue 384: or not. The second message would be lost quietly in Actix but it's just got delayed here.

When I use the same code to talk with Tungstenite based echo server, the issue doesn't appear.

@fafhrd91
Copy link
Member

fixed in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants