多次刷新客户端网页导致sdk服务panic
panic: repeated read on failed websocket connection 15639 15640 goroutine 557 [running]: 15641 github.com/gorilla/websocket.(*Conn).NextReader(0xc000df4c60) 15642 /data/gopkg/pkg/mod/github.com/gorilla/[email protected]/conn.go:1001 +0x269 15643 github.com/gorilla/websocket.(*Conn).ReadMessage(0xc000aec270) 15644 /data/gopkg/pkg/mod/github.com/gorilla/[email protected]/conn.go:1064 +0x19 15645 open_im_sdk/internal/interaction.(*Ws).ReadData(0xc0004c6020) 15646 /data/openim/Open_IM/cmd/Open-IM-SDK-Core/internal/interaction/ws.go:132 +0x238 15647 created by open_im_sdk/internal/interaction.NewWs 15648 /data/openim/Open_IM/cmd/Open-IM-SDK-Core/internal/interaction/ws.go:29 +0xe7
版本:2.0.2
`defer func() { if err := recover(); err != nil { log.Warn("recover from panic for NewWS func") } } () // 加一个捕获就可以
p := Ws{WsRespAsyn: wsRespAsyn, WsConn: wsConn, cmdCh: cmdCh, pushMsgAndMaxSeqCh: pushMsgAndMaxSeqCh, cmdHeartbeatCh: cmdHeartbeatCh} go p.ReadData()
return &p`