Skip to content

Commit

Permalink
Merge pull request #27 from Blue-Flag-Consulting/master
Browse files Browse the repository at this point in the history
switch the connection lost from string check to error type check.
  • Loading branch information
KazuhitoNakamura authored Jan 5, 2024
2 parents 90e290c + e39003c commit f3806cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pure_websocket_subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"errors"
"fmt"
"log"
"net"
"net/http"
"strings"
"time"

"github.com/cenkalti/backoff"
Expand Down Expand Up @@ -222,7 +222,7 @@ func (r *realtimeWebSocketOperation) readLoop() {
_, payload, err := r.ws.ReadMessage()
if err != nil {
log.Println(err)
if strings.Contains(err.Error(), "i/o timeout") {
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
r.onConnectionLost(err)
}
return
Expand Down

0 comments on commit f3806cf

Please sign in to comment.