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 close connection issue #76

Closed
Dumra opened this issue Aug 14, 2024 · 0 comments
Closed

WebSocket close connection issue #76

Dumra opened this issue Aug 14, 2024 · 0 comments

Comments

@Dumra
Copy link

Dumra commented Aug 14, 2024

Hey, guys. Thanks for the great async web socket package.
I have only one issue with that.

After closing the connection to the socket in the k6 test with
ws.close()
or interrupting the k6 test (after establishing a connection and sending a few messages), the server I'm testing receives all the messages sent during that connection again.

import {WebSocket} from 'k6/experimental/websockets';


const ws = new WebSocket(url);
ws.onopen = () => {
    ws.send(JSON.stringify({ msg: 'message 1' })); // Server receives message 1
    sleep(1);
    ws.send(JSON.stringify({ msg: 'message 2' })); // Server receives message 2
    sleep(1);
    ws.close();   // Server receives message 1 and message 2 again: 4 in total (only 2 messages showed in k6 output test metrics)
};

Will be grateful for any help, thanks.

@Dumra Dumra closed this as completed Aug 15, 2024
@joanlopez joanlopez removed their assignment Aug 15, 2024
@joanlopez joanlopez removed the triage label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants