Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
set content-enc on eventstream mode
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Jul 14, 2021
1 parent e0ea134 commit a2e63d8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/server_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ func (s *Server) webHandle(w http.ResponseWriter, r *http.Request) {
s.rssh.ServeHTTP(w, r)
return
case "/sync":
//handle realtime client connections, setting content-encoding to avoid gzip buffer
w.Header().Set("Content-Encoding", "identity")
//handle realtime client connections,
if r.Header.Get("Accept") == "text/event-stream" {
// avoid gzip buffer
w.Header().Set("Content-Encoding", "identity")
}
conn, err := velox.Sync(&s.state, w, r)
if err != nil {
log.Printf("sync failed: %s", err)
Expand Down

0 comments on commit a2e63d8

Please sign in to comment.