Closed jherman closed 4 years ago
Websockets & SCS are incompatible on the same http.ResponseWriter due to both libraries attempting to handle the lifetime of the connection via http hijacking.
Like @1gm says, the difficulty is that the connection is hijacked for the websocket, so the SCS LoadAndSave middleware can't write back to the http.ResponseWriter without an error. SCS doesn't hijack the connection.
Hi,
When I attempt to use websockets, in this case I'm using nhooyr.io/websocket, I get
http: response.WriteHeader on hijacked connection from github.com/alexedwards/scs.(*SessionManager).LoadAndSave.func1 (session.go:159)
exceptions. Is there something I'm not taking into consideration when using sessions and websockets?