Explorar el Código

Merge pull request #825 from caisi35/dev

fix(analytic):client closed error in windows
Jacky hace 3 meses
padre
commit
4e319491b0
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      internal/helper/websocket_error.go

+ 6 - 0
internal/helper/websocket_error.go

@@ -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,