测试ws
This commit is contained in:
@@ -135,7 +135,7 @@ func (c *EventController) TestWebsocket() {
|
|||||||
|
|
||||||
c.EnableRender = false //Beego不启用渲染
|
c.EnableRender = false //Beego不启用渲染
|
||||||
|
|
||||||
var s model.ImMessageRecord
|
var s *model.ImMessageRecord
|
||||||
for {
|
for {
|
||||||
//接收客户端的消息
|
//接收客户端的消息
|
||||||
err := ws.ReadJSON(&s)
|
err := ws.ReadJSON(&s)
|
||||||
@@ -145,7 +145,7 @@ func (c *EventController) TestWebsocket() {
|
|||||||
break //结束循环
|
break //结束循环
|
||||||
} else {
|
} else {
|
||||||
//接受消息 业务逻辑
|
//接受消息 业务逻辑
|
||||||
fmt.Println("接受到从页面上反馈回来的信息 ", s)
|
fmt.Println("接受到从页面上反馈回来的信息 ", utils.Format4Output(s, false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user