Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#13 safari conns #14

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
6 changes: 5 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down