mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-28 13:03:22 +08:00
发布v2.13.1版本,更新内容请查看:https://github.com/bufanyun/hotgo/blob/v2.0/docs/guide-zh-CN/start-update-log.md
This commit is contained in:
@@ -65,7 +65,7 @@ func NewClient(r *ghttp.Request, socket *websocket.Conn, firstTime uint64) (clie
|
||||
closeSignal: make(chan struct{}, 1),
|
||||
FirstTime: firstTime,
|
||||
HeartbeatTime: firstTime,
|
||||
User: contexts.Get(r.Context()).User,
|
||||
User: contexts.GetUser(r.Context()),
|
||||
IP: location.GetClientIp(r),
|
||||
UserAgent: r.UserAgent(),
|
||||
}
|
||||
|
@@ -158,10 +158,19 @@ func (manager *ClientManager) GetUsersLen() (userLen int) {
|
||||
|
||||
// EventRegister 用户建立连接事件
|
||||
func (manager *ClientManager) EventRegister(client *Client) {
|
||||
if client == nil {
|
||||
g.Log().Warningf(mctx, "EventRegister client == nil.")
|
||||
return
|
||||
}
|
||||
manager.AddClients(client)
|
||||
|
||||
var userId int64
|
||||
if client.User != nil {
|
||||
userId = client.User.Id
|
||||
}
|
||||
// 用户登录
|
||||
manager.EventLogin(&login{
|
||||
UserId: client.User.Id,
|
||||
UserId: userId,
|
||||
Client: client,
|
||||
})
|
||||
// 发送当前客户端标识
|
||||
|
Reference in New Issue
Block a user