멤버 접속종료 알림
This commit is contained in:
@ -524,14 +524,23 @@ func (gm *groupInMemory) UpdateGroupDocument(gid groupID, frag bson.M) error {
|
||||
}
|
||||
|
||||
func (gm *groupInMemory) MemberDisconnected(room string, mid primitive.ObjectID) {
|
||||
midstr := mid.Hex()
|
||||
deleted, _ := gm.rh.JSONDel(room, "$._members."+midstr)
|
||||
gid, err := primitive.ObjectIDFromHex(room)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
gd := &groupDoc{
|
||||
id: gid,
|
||||
rh: gm.rh,
|
||||
}
|
||||
|
||||
tid := gd.tid(mid)
|
||||
deleted, _ := gm.rh.JSONDel(room, "$._members."+tid)
|
||||
if deleted > 0 {
|
||||
// 퇴장을 알림
|
||||
gm.sendUpstreamMessage(&wshandler.UpstreamMessage{
|
||||
Target: "#" + room,
|
||||
Body: bson.M{
|
||||
midstr: bson.M{},
|
||||
tid: bson.M{},
|
||||
},
|
||||
Tag: []string{"MemberDocFull"},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user