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

No Http Response when WebSocket protocol error: No "Connection: upgrade" header #243

Closed
leptonyu opened this issue Oct 11, 2022 · 2 comments
Labels

Comments

@leptonyu
Copy link

Is there any way to get the stream back from tungstenite?

@daniel-abramov
Copy link
Member

Do I get it right, the issue that you're describing is that you're trying to establish a WebSocket connection, it fails and returns the error, but you would like to get the stream back from it? - If so, we currently don't really support this explicitly unfortunately, i.e. if you use connect(), then it all happens internally from tungstenite and I doubt that the stream returned from the connect() failure would be particularly useful. What might be more useful is to get the stream back in case you're using client() or some other function and want to access the internal stream after the failure. While we don't return such a stream back, you can easily workaround it by providing your own stream that can be clonable, i.e. pass one part to the tungstenite, tungstenite will consume the stream and then in case of failure you can still use the other counterpart that you had saved.

The tracking issue to return the stream back on failure is: snapview/tungstenite-rs#51 (you've already found it though 😉)

@leptonyu
Copy link
Author

Thanks for your reply.
I created a http buffer stream to preload the request from stream.

gregates pushed a commit to gregates/tokio-tungstenite that referenced this issue Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants