Skip to content

Implement http.Hijacker to support interaction with Websockets #131

@durdn

Description

@durdn

Hey there,

You wrote a fantastic library and I've been using it with pleasure so far. Up until Yesterday I was using https://github.com/NYTimes/gziphandler to compress all the responses passing through my routes. Then I saw you already have implemented a middleware that does the exact same thing! RTFM right? :)

Anyway I have run into an issue when using the middleware.DefaultCompress and gorilla/websocket (and I saw reports of similar failures for people using 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

Also the gziphandler project mentioned above has just committed the same change just the other day after I reported the problem:
nytimes/gziphandler#26

Other useful thread:
gin-gonic/gin#51

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

I am not on a quest for getting this issue fixed everywhere btw, I just found out chi has the capability I need and I always try to reduce my dependencies whenever possible.

Thanks for listening!
Cheers!
Nick

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions