diff --git a/contrib/codecs/http/codecs.go b/contrib/codecs/http/codecs.go index a930170c3c9b10107c757d5d344bd9a4c66d74d7..121e740515e987dbe407f80d0136f6e4461387f9 100644 --- a/contrib/codecs/http/codecs.go +++ b/contrib/codecs/http/codecs.go @@ -31,7 +31,7 @@ type HttpCodec struct { func NewCodec(w http.ResponseWriter, r *http.Request) (jsonrpc.ReaderWriter, error) { switch r.Method { case http.MethodGet: - if r.Header.Get("Accept") == "text/event-stream" { + if r.Header.Get("Accept") == "text/event-stream" || r.URL.Query().Has("sse") { return NewSseCodec(w, r) } return NewGetCodec(w, r), nil diff --git a/example/subscription/main.go b/example/subscription/main.go index 38014a69f6a3b7a521e01706d6090842d092d1b3..bf87299cac35d8334664c97b380dccfc608207f2 100644 --- a/example/subscription/main.go +++ b/example/subscription/main.go @@ -77,6 +77,6 @@ func client() error { }() defer jcs.Unsubscribe() for { - log.Println("receiving", <-out) + //log.Println("receiving", <-out) } }