Compare commits

..

No commits in common. "2009d3403a11ddebf95dcfee60e0a6b2d2fc40e9" and "a78f7a166e67903497269e159f4c33934225bc8d" have entirely different histories.

1 changed files with 4 additions and 9 deletions

View File

@ -368,13 +368,8 @@ func ServerSsendMsgV2(c *gin.Context) {
msg := msgs[0]
//发送消息
msg_str, _ := json.Marshal(msg)
var msg_ proto.Message
msg_.Type = "msg"
msg_.Msg = string(msg_str)
msg_str2, _ := json.Marshal(msg_)
err2 := ws.WriteMessage(websocket.TextMessage, msg_str2)
if err2 != nil {
_, err := c.Writer.Write([]byte("data: " + string(msg_str) + "\n\n"))
if err != nil {
worker.SetRedisWithExpire("user_"+strconv.Itoa(user_id)+"_status_v2", "0", time.Second*3600)
clientsMux.Lock()
delete(clients, ws)
@ -389,8 +384,8 @@ func ServerSsendMsgV2(c *gin.Context) {
msg.From_user_id = -1
//发送心跳包
res3, _ := json.Marshal(msg)
err2 := ws.WriteMessage(websocket.TextMessage, res3)
if err2 != nil {
_, err := c.Writer.Write([]byte("data: " + string(res3) + "\n\n"))
if err != nil {
worker.SetRedisWithExpire("user_"+strconv.Itoa(user_id)+"_status_v2", "0", time.Second*3600)
clientsMux.Lock()
delete(clients, ws)