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

*scs.sessionResponseWriter does not implement http.Hijacker #188

Open
NewHouses opened this issue Nov 28, 2023 · 3 comments · May be fixed by #199
Open

*scs.sessionResponseWriter does not implement http.Hijacker #188

NewHouses opened this issue Nov 28, 2023 · 3 comments · May be fixed by #199

Comments

@NewHouses
Copy link

Hey there! 👋 It seems like we've hit a small roadblock with the scs.sessionResponseWriter wrapper for http.response. Currently, it doesn't implement the http.Hijacker interface. So, when attempting to open a WebSocket, you might encounter the error message: websocket: response does not implement http.Hijacker.

In the past, it were using *scs.bufferedResponseWriter, which conveniently does implement the Hijacker interface.

@VipWW
Copy link

VipWW commented Feb 3, 2024

@alexedwards would you kindly accept pull request with a fix to this error?

@alexedwards
Copy link
Owner

alexedwards commented Feb 3, 2024

I think that the correct fix here is really for the websocket library to start supporting http.ResponseController, which is the modern way of dealing with this.

I've pushed a38e822 which makes sessionResponseWriter implement the Hijacker and Flusher interfaces for Go 1.20+. Please let me know if it solves your problem.

@VipWW
Copy link

VipWW commented Feb 12, 2024

Thank you, works like a charm!

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

Successfully merging a pull request may close this issue.

3 participants