mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-28 02:19:04 +08:00
发布代码生成、更新20+表单组件,优化数据字典,gf版本更新到2.3.1
This commit is contained in:
@@ -9,13 +9,13 @@ package websocket
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/container/garray"
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/guid"
|
||||
"github.com/gorilla/websocket"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/library/location"
|
||||
"hotgo/internal/model"
|
||||
@@ -164,12 +164,6 @@ func (c *Client) close() {
|
||||
return
|
||||
}
|
||||
c.SendClose = true
|
||||
//if _, ok := <-c.Send; !ok {
|
||||
// g.Log().Warningf(ctxManager, "close of closed channel, client.id:%v", c.ID)
|
||||
//} else {
|
||||
// // 关闭 chan
|
||||
// close(c.Send)
|
||||
//}
|
||||
c.closeSignal <- struct{}{}
|
||||
}
|
||||
|
||||
@@ -187,7 +181,7 @@ func SendSuccess(client *Client, event string, data ...interface{}) {
|
||||
client.SendMsg(&WResponse{
|
||||
Event: event,
|
||||
Data: d,
|
||||
Code: consts.CodeOK,
|
||||
Code: gcode.CodeOK.Code(),
|
||||
Timestamp: gtime.Now().Unix(),
|
||||
})
|
||||
before(client)
|
||||
@@ -197,7 +191,7 @@ func SendSuccess(client *Client, event string, data ...interface{}) {
|
||||
func SendError(client *Client, event string, err error) {
|
||||
client.SendMsg(&WResponse{
|
||||
Event: event,
|
||||
Code: consts.CodeNil,
|
||||
Code: gcode.CodeNil.Code(),
|
||||
ErrorMsg: err.Error(),
|
||||
Timestamp: gtime.Now().Unix(),
|
||||
})
|
||||
|
@@ -31,7 +31,7 @@ var (
|
||||
// Start 启动
|
||||
func Start(c context.Context) {
|
||||
ctxManager = c
|
||||
g.Log().Info(ctxManager, "启动:WebSocket")
|
||||
g.Log().Debug(ctxManager, "start websocket..")
|
||||
go clientManager.start()
|
||||
go clientManager.ping()
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ type WRequest struct {
|
||||
type WResponse struct {
|
||||
Event string `json:"event"` // 事件名称
|
||||
Data interface{} `json:"data,omitempty"` // 数据
|
||||
Code int64 `json:"code"` // 状态码
|
||||
Code int `json:"code"` // 状态码
|
||||
ErrorMsg string `json:"errorMsg,omitempty"` // 错误消息
|
||||
Timestamp int64 `json:"timestamp"` // 服务器时间
|
||||
}
|
||||
|
Reference in New Issue
Block a user