Commit e415f474 authored by haoyanbin's avatar haoyanbin

End

parent 8341cca6
......@@ -26,7 +26,7 @@ const (
//
closeWait = 60 * 30 * time.Second
// time for auto end
endDate = 60 * 10 * time.Second
endDate = 60 * 30 * time.Second
)
var cliKey = "clients"
......
......@@ -495,10 +495,11 @@ func SetEnd() {
UnserislizeJson([]byte(vClients), conversationData)
if conversationData.StartReceiveDate < time.Now().Add(-endDate).Format("2006-01-02 15:04:05") {
mqData := &SendMsg{
ProcedureType: 8,
ToClientId: conversationData.Promoter,
FromClientId: conversationData.Participant,
SendTime: time.Now().Format("2006-01-02 15:04:05"),
ProcedureType: 8,
ConversationId: conversationData.ConversationId,
ToClientId: conversationData.Promoter,
FromClientId: conversationData.Participant,
SendTime: time.Now().Format("2006-01-02 15:04:05"),
}
//发送结束会话给客户端
_, isSet := wsSever.hub.clients[conversationData.Promoter]
......@@ -508,6 +509,7 @@ func SetEnd() {
toMqData := &SendMsg{
ProcedureType: 8,
ConversationId: conversationData.ConversationId,
ToClientId: conversationData.Participant,
FromClientId: conversationData.Promoter,
SendTime: time.Now().Format("2006-01-02 15:04:05"),
......
......@@ -43,12 +43,12 @@ func main() {
})
//自动结束会话
ticker := time.NewTicker(time.Second * 10)
go func() {
for range ticker.C {
pool.SetEnd()
}
}()
//ticker := time.NewTicker(time.Second * 10)
//go func() {
// for range ticker.C {
// //pool.SetEnd()
// }
//}()
mux := http.NewServeMux()
mux.HandleFunc("/", serveHome)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment