增加限流

pull/23/head
taoshihan1991 4 years ago
parent 378bfbe76a
commit 5ed0a4ca03

@ -126,9 +126,14 @@ func WsServerBackend() {
defer message.Mux.Unlock() defer message.Mux.Unlock()
conn.WriteMessage(websocket.TextMessage, str) conn.WriteMessage(websocket.TextMessage, str)
case "inputing": case "inputing":
to := typeMsg.Data.(map[string]interface{})["to"].(string) data := typeMsg.Data.(map[string]interface{})
from := data["from"].(string)
to := data["to"].(string)
//限流
if tools.LimitFreqSingle("inputing:"+from, 1, 2) {
OneKefuMessage(to, message.content) OneKefuMessage(to, message.content)
} }
}
} }
} }

Loading…
Cancel
Save