From cc9c520f1ecf11e5786f2aca8d9cf24ef4af2f2e Mon Sep 17 00:00:00 2001 From: sotoslammer Date: Fri, 10 Jul 2020 16:37:06 -0600 Subject: [PATCH] close the connection when run returns --- graphql/handler/transport/websocket.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/graphql/handler/transport/websocket.go b/graphql/handler/transport/websocket.go index a59574f545a..3089a877999 100644 --- a/graphql/handler/transport/websocket.go +++ b/graphql/handler/transport/websocket.go @@ -136,7 +136,10 @@ func (c *wsConnection) run() { // We create a cancellation that will shutdown the keep-alive when we leave // this function. ctx, cancel := context.WithCancel(c.ctx) - defer cancel() + defer func() { + cancel() + c.close(websocket.CloseAbnormalClosure, "unexpected closure") + }() // Create a timer that will fire every interval to keep the connection alive. if c.KeepAlivePingInterval != 0 {