草庐IT

MessageNotification

全部标签

Go Channel读写卡死循环

首先,我想做一个长轮询通知系统。更具体地说,我将发出http请求,只有当mapchannel为true时才会返回响应。这是我使用的代码块:varMessageNotification=make(map[string]chanbool,10)funcGetNotification(idint,timestampint)notification{这是Controllerblock:func(c*ChatController)Notification(){data:=chat.GetNotification(1,0)c.Data["json"]=datac.ServeJSON()}func(

Go Channel读写卡死循环

首先,我想做一个长轮询通知系统。更具体地说,我将发出http请求,只有当mapchannel为true时才会返回响应。这是我使用的代码块:varMessageNotification=make(map[string]chanbool,10)funcGetNotification(idint,timestampint)notification{这是Controllerblock:func(c*ChatController)Notification(){data:=chat.GetNotification(1,0)c.Data["json"]=datac.ServeJSON()}func(