Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Detecting client closed connection
func handleRequest(w http.ResponseWriter, r *http.Request) {
cn := w.(http.CloseNotifier)
cc := cn.CloseNotify()
go func() {
time.Sleep(5 * time.Second)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment