Azure / azure-webpubsub

Azure Web PubSub Service helps you to manage WebSocket connections and do publish and subscribe in an easy way
https://azure.github.io/azure-webpubsub/
MIT License
135 stars 86 forks source link

Document groups better #319

Open lkurth opened 2 years ago

lkurth commented 2 years ago

Is your feature request related to a problem? Please describe.

I have questions about how to use groups. I have taken the C# chat app sample and added some group features to it. It seems to be working. But I don't have static groups. I need to create groups dynamically when they are required.

  1. I've been able to create a group by adding a user to a group providing a random group name. Is this the way that a group should be created, i.e. by adding a user to a non-existent group and the group is created at that time? I don't see another way, except to add a connection to a group.
  2. What is the lifecycle for a group? Does a group automatically go away when all users have been removed from the group? Or does it remain in place? I don't see a way to directly remove a group via the API. I would be managing the groups from the server side.

For my application, it would be simplest if I could just create a group with a random name when one is needed. Then add additional users to it. When that "group session" is complete, I could simply remove the users from the group and that would be the end-of-life for the group. However, it groups remain forever, then I would be building an ever-growing set of groups. My design would probably need to change.

Describe the solution you'd like

I'd like to see more documentation for groups. Everything about how they are created, how to manage users in a group, what happens to a group when the last user is removed, etc. I've searched the internet a lot looking for more info on groups and I've come up empty. What I've learned has been from experimentation. It would be nice to have at least an overview of groups.

I really like the Web PubSub feature. I've been looking at ways to build person-to-person and group chat into an app for a couple of years. I previously looked at the Azure SignalR service, which would certainly work. But PubSub seems to simplify things a lot. I would have used SignalR but the priority for a chat feature has risen lately. When I went looking for a way to do it, I found PubSub.

Additional context

None that would be helpful.

vicancy commented 2 years ago

Thanks for the feedback.

A quick answer to the questions: I think the "group session" term exactly describes what the group is. The "group session" starts when some connection joins it, and the "group session" ends when no connection is in it.

  1. Group is created at the time some connection joins the group
  2. Adding a user to a group is a shortcut for adding the current connections belonging to the user to a group
  3. We consider the group does not exist when there are no connections in the group
lkurth commented 2 years ago

Thanks! You answered my questions about groups. The way it works is the best for what I am doing.