Compare commits
No commits in common. "350a439f89edf52ae6ff4ccc5db3d2011aba6744" and "766b58ae404f13a78f2cf827fc9d82d9a90c82d0" have entirely different histories.
350a439f89
...
766b58ae40
|
|
@ -175,7 +175,6 @@ func SRMessage(c *gin.Context) {
|
||||||
}
|
}
|
||||||
}(ws, res, to_user_id)
|
}(ws, res, to_user_id)
|
||||||
|
|
||||||
var status_cnt int
|
|
||||||
// 从Redis中读取消息并发送到客户端
|
// 从Redis中读取消息并发送到客户端
|
||||||
for {
|
for {
|
||||||
if v := clients[ws]; v == true {
|
if v := clients[ws]; v == true {
|
||||||
|
|
@ -207,17 +206,12 @@ func SRMessage(c *gin.Context) {
|
||||||
res3, _ = json.Marshal(msg)
|
res3, _ = json.Marshal(msg)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if status_cnt > 5 {
|
|
||||||
//对方不在线
|
//对方不在线
|
||||||
msg.Type = "offline"
|
msg.Type = "offline"
|
||||||
msg.Msg = "offline"
|
msg.Msg = "offline"
|
||||||
msg.From_user_id = -1
|
msg.From_user_id = -1
|
||||||
msg.Session = res
|
msg.Session = res
|
||||||
res3, _ = json.Marshal(msg)
|
res3, _ = json.Marshal(msg)
|
||||||
} else {
|
|
||||||
status_cnt++
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
err2 := ws.WriteMessage(websocket.TextMessage, res3)
|
err2 := ws.WriteMessage(websocket.TextMessage, res3)
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue