You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.
curl it through goproxy (or use a proper SSE client in javascript using an EventSource)
Problem: the goproxy will always return 80 messages as a bunch and buffer inbetween. That renders SSE unusable through goproxy, because the point of SSE is to informed about each individual message.
I would suggest to handle SSE with an explicit Flush, e.g. like that in proxy.go (line 150):
var copyWriter io.Writer = w
if w.Header().Get("content-type") == "text/event-stream" {
copyWriter = NewFlushWriter(w)
}
nr, err := io.Copy(copyWriter , resp.Body)
The FlushWriter would just overwrite "write" and call a flush afterwards:
type FlushWriter struct {
w io.Writer
}
func NewFlushWriter(w io.Writer) *FlushWriter {
return &FlushWriter{w: w}
}
func (w *FlushWriter) Write(b []byte) (int, error) {
bytes, err := w.w.Write(b)
if f, ok := w.w.(http.Flusher); ok {
f.Flush()
}
return bytes, err
}
I had initially reported that fix at eclipse-che/che#15942 but then realized that this is actually in goproxy.
The text was updated successfully, but these errors were encountered:
When using goproxy with SSE, the events are buffered, rendering that useless.
Scenario:
Problem: the goproxy will always return 80 messages as a bunch and buffer inbetween. That renders SSE unusable through goproxy, because the point of SSE is to informed about each individual message.
I would suggest to handle SSE with an explicit Flush, e.g. like that in
proxy.go
(line 150):The FlushWriter would just overwrite "write" and call a flush afterwards:
I had initially reported that fix at eclipse-che/che#15942 but then realized that this is actually in goproxy.
The text was updated successfully, but these errors were encountered: