handy icon indicating copy to clipboard operation
handy copied to clipboard

report.JSON breaks websockets

Open ohookins opened this issue 8 years ago • 4 comments

If you wrap your websocket Handler in report.JSON you end up with something like this:

2017/01/10 14:15:43 websocket: response does not implement http.Hijacker

ohookins avatar Jan 10 '17 15:01 ohookins

@ohookins: That's quite common problem, not only present in handy but in most libs wrapping various "upgradable" interfaces. Here's a good read about upgradeable interfaces, the problems they solve and the ones they bring: https://avtok.com/2014/11/05/interface-upgrades.html

This PR solves it for gzipWriter. But there are more interfaces which ResponseWriter can be upgraded to...

telendt avatar Jan 11 '17 14:01 telendt

@telendt I guess that's just a simpler version of this: https://github.com/prometheus/client_golang/blob/master/prometheus/http.go#L296-L306

ohookins avatar Jan 11 '17 14:01 ohookins

@streadway are you ok with me making a PR for report along the lines of #28 ? Or perhaps @telendt is kind enough to add report to the same PR...

ohookins avatar Jan 11 '17 15:01 ohookins

Go for it. There are a few more interfaces to implement as well for http/2 support.

streadway avatar Jan 11 '17 20:01 streadway