I'm writing a web app where the client and server communicate via a websocket. After a login event I set a cookie using the gorilla/sessions package, but in order for the browser to learn about this, I need to write a response from my socket handler. But since I've upgraded to a websocket connection, when I try to write anything to the http.ResponseWriter, I get an error "
http: response.Write on hijacked connection".
Is there any way to write a response or set a cookie from a websocket handler? This would occur only when the socket closes.