Merge pull request #825 from caisi35/dev

fix(analytic):client closed error in windows
This commit is contained in:
Jacky 2025-01-22 16:20:43 +08:00 committed by GitHub
commit 4e319491b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
package helper
import (
"strings"
"github.com/gorilla/websocket"
"github.com/pkg/errors"
"syscall"
@ -15,6 +16,11 @@ func IsUnexpectedWebsocketError(err error) bool {
if errors.Is(err, syscall.EPIPE) {
return false
}
// client closed error: *net.OpErr
if strings.Contains(err.Error(), "An existing connection was forcibly closed by the remote host") {
return true
}
return websocket.IsUnexpectedCloseError(err,
websocket.CloseGoingAway,
websocket.CloseNoStatusReceived,