diff --git a/relay.go b/relay.go index 18a27f5..a527710 100644 --- a/relay.go +++ b/relay.go @@ -9,6 +9,7 @@ import ( "log" "net/http" "strconv" + "strings" "sync" "sync/atomic" "time" @@ -187,7 +188,7 @@ func (r *Relay) ConnectWithTLS(ctx context.Context, tlsConfig *tls.Config) error case <-ticker.C: if r.Connection != nil { err := r.Connection.Ping(r.connectionContext) - if err != nil { + if err != nil && !strings.Contains(err.Error(), "failed to wait for pong") { InfoLogger.Printf("{%s} error writing ping: %v; closing websocket", r.URL, err) r.Close() // this should trigger a context cancelation return