fix: call onclose when conn closes
This commit is contained in:
parent
fa11551e26
commit
eaa39ffc49
|
|
@ -4,7 +4,7 @@ import (
|
|||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/shinosaki/websocket-client-go/websocket"
|
||||
"git.min.rip/min/websocket-client-go/websocket"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -1,4 +1,4 @@
|
|||
module github.com/shinosaki/websocket-client-go
|
||||
module git.min.rip/min/websocket-client-go
|
||||
|
||||
go 1.23.6
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ func (ws *WebSocketClient) Connect(
|
|||
var payload []byte
|
||||
if err := websocket.Message.Receive(ws.conn, &payload); err != nil {
|
||||
// log.Println("receive error", err)
|
||||
if ws.onClose != nil {
|
||||
ws.onClose(ws, isReconnecting)
|
||||
}
|
||||
return
|
||||
}
|
||||
ws.onMessage(ws, payload)
|
||||
|
|
|
|||
Loading…
Reference in New Issue