Compare commits

..

2 Commits

Author SHA1 Message Date
junleea c17348d3ad Merge branch 'refs/heads/feature-im-gitea' 2024-08-08 16:47:20 +08:00
junleea fe9d0650dc fix sse 2024-08-08 16:46:43 +08:00
1 changed files with 2 additions and 1 deletions

View File

@ -362,7 +362,8 @@ func ServerSendMsg(c *gin.Context) {
if len(msgs) > 0 { if len(msgs) > 0 {
msg := msgs[0] msg := msgs[0]
//发送消息 //发送消息
_, err := c.Writer.Write([]byte("data: " + msg.Msg + "\n\n")) msg_str, _ := json.Marshal(msg)
_, err := c.Writer.Write([]byte("data: " + string(msg_str) + "\n\n"))
if err != nil { if err != nil {
worker.SetRedisWithExpire("user_"+strconv.Itoa(user_id)+"_status_v2", "0", time.Second*3600) worker.SetRedisWithExpire("user_"+strconv.Itoa(user_id)+"_status_v2", "0", time.Second*3600)
break break