Skip to content

Commit

Permalink
fix: update open-im-sdk-core version.
Browse files Browse the repository at this point in the history
  • Loading branch information
FGadvancer committed Nov 6, 2023
1 parent 45f6664 commit 5b9f308
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ func (gt *GateNet) CloseGate() {
func main() {
var sdkWsPort, logLevel *int
var openIMWsAddress, openIMApiAddress, openIMDbDir *string
openIMApiAddress = flag.String("openIM_api_address", "http://14.29.213.197:50002",
openIMApiAddress = flag.String("openIM_api_address", "http://125.124.195.201:10002",
"openIM api listening address")
openIMWsAddress = flag.String("openIM_ws_address", "ws://14.29.213.197:50001",
openIMWsAddress = flag.String("openIM_ws_address", "ws://125.124.195.201:10001",
"openIM ws listening address")
sdkWsPort = flag.Int("sdk_ws_port", 10003, "openIMSDK ws listening port")
logLevel = flag.Int("openIM_log_level", 6, "control log output level")
Expand Down
16 changes: 8 additions & 8 deletions example/module/MActor.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ func (actor *MActorIm) run() {
//} else {
actor.sendEventResp(resp) // todo send msg
//}
case <-actor.heartTicker.C:
if actor.heartFlag == true {
actor.heartFlag = false
} else {
log.Error("心跳包超时错误", "sessionId", actor.SessionId)
actor.isclosing = true
actor.a.Destroy()
}
//case <-actor.heartTicker.C:
// if actor.heartFlag == true {
// actor.heartFlag = false
// } else {
// log.Error("心跳包超时错误", "sessionId", actor.SessionId)
// actor.isclosing = true
// actor.a.Destroy()
// }
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions network/ws_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ func (handler *WSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
conn.SetReadLimit(int64(handler.maxMsgLen))
_ = conn.SetReadDeadline(time.Now().Add(30 * time.Second))
conn.SetPongHandler(func(appData string) error {
conn.SetReadDeadline(time.Now().Add(30 * time.Second))
log.Error("js自动心跳包")
return nil
})

handler.wg.Add(1)
defer handler.wg.Done()
Expand Down

0 comments on commit 5b9f308

Please sign in to comment.