pitaya icon indicating copy to clipboard operation
pitaya copied to clipboard

How to know which groups a member has joined

Open dskyu opened this issue 3 years ago • 2 comments

some methods like pitaya.MemberGroups etc..

dskyu avatar May 12 '21 10:05 dskyu

Right now you would need to call

func GroupMembers(ctx context.Context, groupName string) ([]string, error)

for each group you have and see if the player is there.

an alternative would be to put the group list in the player agent

what is the use case?

felipejfc avatar May 12 '21 13:05 felipejfc

There are some use case: If one player add to lots of group, when the player is kicked or offline, framework should remove the player from all raleted groups. If one player add to a game room, then he add to another room, before this, framework should remove the player from the previous one.

Now If only using GroupMembers, we need add a new interface like GroupAll, then scan each of groups to remove the specified player. It may be not elegant and slow.

dskyu avatar May 13 '21 02:05 dskyu