diff --git a/go.mod b/go.mod index 41b0a4a..c66c898 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.20 require ( github.com/google/go-cmp v0.5.9 + github.com/hashicorp/go-cleanhttp v0.5.2 golang.org/x/sync v0.2.0 nhooyr.io/websocket v1.8.7 ) diff --git a/server.go b/server.go index c3347e6..19291da 100644 --- a/server.go +++ b/server.go @@ -67,7 +67,11 @@ func (s Server) routes(ctx context.Context) { // newWebSocketHandler upgrades a request to a long-running websocket connection. func (s Server) newWebSocketHandler() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - conn, err := websocket.Accept(w, r, nil) + conn, err := websocket.Accept(w, r, &websocket.AcceptOptions{ + // prevents kNWErrorDomainPOSIX error on safari + // https://github.com/nhooyr/websocket/issues/218 + CompressionMode: websocket.CompressionDisabled, + }) if err != nil { s.Log.Printf("websocket upgrade failed: %s", err) return