-
Notifications
You must be signed in to change notification settings - Fork 320
Closed
Description
I have a Goroutine on my server that should return if the connection is closed. How can I know if it was closed? Is there a channel that is closed when that happens or something similar? I'd like to write something like this:
conn, err := websocket.Accept(w, r, nil)
// ...
select {
case <-ctx.Done():
// do something if the ctx of my function is done
case something: // some event selection expression that happens when conn is closed
// release resources now that conn is closed
return
}
Is this possible? Are there any workarounds?
Metadata
Metadata
Assignees
Labels
No labels