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

Multiple operations over one WebSocket connection. #18

Closed
BratSinot opened this issue May 25, 2021 · 3 comments
Closed

Multiple operations over one WebSocket connection. #18

BratSinot opened this issue May 25, 2021 · 3 comments

Comments

@BratSinot
Copy link
Contributor

For example this cause panic:

        let mut stream = client
            .streaming_operation(WorkspaceVoiceVoicemail::build(()))
            .await;

        for _ in 0..5 {
            let data = stream
                .next()
                .await
                .unwrap()
                .data
                .unwrap();
        }

        stream = client
            .streaming_operation(WorkspaceVoiceVoicemail::build(()))
            .await;

        for _ in 0..5 {
            let data = stream
                .next()
                .await
                .unwrap()
                .data
                .unwrap();
        }

Somehow need send Complete to server when the stream is droping.

@BratSinot
Copy link
Contributor Author

Hm… But I have socket (client) I can send message by myself.
So, I don't know which more idiomatic in Rust by destructor (drop) or manual.

@obmarg
Copy link
Owner

obmarg commented May 26, 2021

I had some vague plans for dealing with stuff like this. At the moment StreamingOperation just returns an anonymous impl Stream, but I figured it should probably return a concrete type that implements Stream.

That'll give us a place to stick any extra functionality that we need - functions to check the stream for errors, functions to disconnect, and I assume we could put a custom drop impl on it to send that Complete message. Imagine it might need to hold a copy of the clients sender_sink so that it can send a Complete message using it...

@BratSinot
Copy link
Contributor Author

Hm... This is definitely Duplicate of #7

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