접속 종료를 그룹에 알림

This commit is contained in:
2023-07-19 17:02:49 +09:00
parent 07cb4848fe
commit 4f1c79d3b7
5 changed files with 28 additions and 1 deletions

View File

@ -523,6 +523,21 @@ func (gm *groupInMemory) UpdateGroupDocument(gid groupID, frag bson.M) error {
return nil
}
func (gm *groupInMemory) MemberDisconnected(room string, mid primitive.ObjectID) {
midstr := mid.Hex()
deleted, _ := gm.rh.JSONDel(room, "$._members."+midstr)
if deleted > 0 {
// 퇴장을 알림
gm.sendUpstreamMessage(&wshandler.UpstreamMessage{
Target: "#" + room,
Body: bson.M{
midstr: bson.M{},
},
Tag: []string{"MemberDocFull"},
})
}
}
func (cfg *groupConfig) prepareInMemory(ctx context.Context, typename string, sub *subTavern) (group, error) {
// group document
// member document