Why does this tutorial maintain a list of PubSub channels? + naming a PubSub chat channel

In this tutorial at 24:24, he implements a Subscription as part of the messaging application.

There’s one bit I don’t quite understand. Why is it that he generates a random string for every client which is subscribed, and maintains a list of all subscribed clients? Is this supposed to address some security concern?

Is there anything inherently wrong with just naming the channel “CHAT_CHANNEL” and publishing all the messages to that channel?

For an open chat room with multiple users, it doesn’t seem efficient to need to iterate over multiple channels when all we need is one channel since the only things that are going to be sent on that channel are messages sent in that chatroom. Or if we have a single Chatroom ID shared among all the users, that could be used as well, then at least it’s varied for each chatroom. This is varied for every client within this chatroom.

There’s an extra step there which I can’t find a reason as to why it’s necessary.

Side-question: If I were to implement a chat feature in my app where there are no chats with multiple users, only chats between individual users, how should the chat channels be managed? If User A has a chat with User B, could I name the channel “<userID_A>_<userID_B>” where I order their userID’s lexicographically? Here we suppose User A’s userID is “lesser” than User B’s userID. Does this predictable nature pose any security risk? Should I be generating a random string as the ID for a chat between two users?