From dc2af41eb6f3268010350a43b7db1cdff615d2bb Mon Sep 17 00:00:00 2001 From: Guiheux Steven Date: Wed, 3 Jun 2020 09:16:12 +0200 Subject: [PATCH] fix(api): remove client when close message was send (#5227) --- engine/api/websocket.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engine/api/websocket.go b/engine/api/websocket.go index f6c02ef096..b3fb343af0 100644 --- a/engine/api/websocket.go +++ b/engine/api/websocket.go @@ -401,6 +401,10 @@ func (c *websocketClient) send(ctx context.Context, event sdk.Event) (err error) Event: event, } if err := c.con.WriteJSON(msg); err != nil { + // ErrCloseSent is returned when the application writes a message to the connection after sending a close message. + if err == websocket.ErrCloseSent { + return sdk.WithStack(err) + } if strings.Contains(err.Error(), "use of closed network connection") { return sdk.WithStack(err) }