DoomDuck / transcendence

0 stars 0 forks source link

Advice for relationship beetween User and channel #70

Closed Hgallien closed 2 years ago

Hgallien commented 2 years ago

You advised me against storing the channelID in the user class instance AND storing the UserID in the channel class. The most logical approach would be to store the user ID in the channel, but with this it get tricky to handle the multiple tab a user can open (that create multiple socketid for the same user). As an example, when a user open a new tab, if the user class doesn't know the list of his channel i need to search in every channel if the said user is currently in it and then add this new tocket to the room (room is object that is use are to emit to a certain group of socket).

In conclusion i feel like a need to do this 'double inclusion', an array of member in everychan and in every user an array of the channel.