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

Implement http.Hijacker to support interaction with Websockets #26

Closed
durdn opened this issue Jan 3, 2017 · 3 comments
Closed

Implement http.Hijacker to support interaction with Websockets #26

durdn opened this issue Jan 3, 2017 · 3 comments

Comments

@durdn
Copy link

durdn commented Jan 3, 2017

Hey there,

You wrote a fantastic library and I've been using it with pleasure so far.

I have run into an issue when using the GzipHandler and gorilla/websocket (and I saw reports of similar failures for code.google.com/p/go.net/websocket):

I run into this:

websocket: response does not implement http.Hijacker

It seems the response interface of your library does not implement http.Hijacker which is needed to use websockets.

The fix appears relatively easy and several other libraries have implemented a fix. For example:

caddyserver/caddy@05957b4

https://github.com/gin-gonic/gin/pull/105/files

Other useful thread:
gin-gonic/gin#51

I probably can work around my problem by not using the GzipHandler in bulk for all my routes but I thought you'd be interested in the problem and possibly copy the fixes above.

brianfoshee added a commit to brianfoshee/gziphandler that referenced this issue Jan 3, 2017
brianfoshee added a commit to brianfoshee/gziphandler that referenced this issue Jan 4, 2017
brianfoshee added a commit to brianfoshee/gziphandler that referenced this issue Jan 4, 2017
@durdn
Copy link
Author

durdn commented Jan 4, 2017

@jprobinson Let me just say this response speed is incredible. Thanks a lot!

@jprobinson
Copy link
Contributor

This one was all @brianfoshee. Thanks for using the lib!!

@durdn
Copy link
Author

durdn commented Jan 4, 2017

Oh right Thanks a lot to @brianfoshee !!

kujenga added a commit to kujenga/go-stdlib that referenced this issue Jul 16, 2018
This is needed in order for users of this package to implement websocket
support, as without it, the statusCodeTracker struct does not implement
the correct interface because it knows nothing about the underlying
implementation of it's embedded http.ResponseWriter.

For reference, many other project have had this same issue, here's a
list of some found in a quick search for the issue, I'm sure there are
others as well:
- golang/go#14797
- census-instrumentation/opencensus-go#642
- go-chi/chi#131
- nytimes/gziphandler#26
- caddyserver/caddy#133
- emicklei/go-restful#354
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