MCPcopy
hub / github.com/link1st/gowebsocket / checkUserOnline

Function checkUserOnline

servers/websocket/user_srv.go:65–83  ·  view source on GitHub ↗

查询用户 是否在线

(appId uint32, userId string)

Source from the content-addressed store, hash-verified

63
64// 查询用户 是否在线
65func checkUserOnline(appId uint32, userId string) (online bool, err error) {
66 key := GetUserKey(appId, userId)
67 userOnline, err := cache.GetUserOnlineInfo(key)
68 if err != nil {
69 if err == redis.Nil {
70 fmt.Println("GetUserOnlineInfo", appId, userId, err)
71
72 return false, nil
73 }
74
75 fmt.Println("GetUserOnlineInfo", appId, userId, err)
76
77 return
78 }
79
80 online = userOnline.IsOnline()
81
82 return
83}
84
85// 给用户发送消息
86func SendUserMessage(appId uint32, userId string, msgId, message string) (sendResults bool, err error) {

Callers 1

CheckUserOnlineFunction · 0.85

Calls 3

GetUserOnlineInfoFunction · 0.92
GetUserKeyFunction · 0.85
IsOnlineMethod · 0.80

Tested by

no test coverage detected