diff --git a/signalflow/conn.go b/signalflow/conn.go index 8296599..094eacf 100644 --- a/signalflow/conn.go +++ b/signalflow/conn.go @@ -82,6 +82,11 @@ func (c *wsConn) Run() { c.PostDisconnectCallback() } + if c.ctx.Err() == context.Canceled { + log.Printf("Context cancelled, stop reconnecting.") + return + } + var err error conn, err = c.connect() if err != nil {