Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Removing user from group outside of hub #109

Open
lwansbrough opened this issue Nov 25, 2019 · 1 comment
Open

Removing user from group outside of hub #109

lwansbrough opened this issue Nov 25, 2019 · 1 comment
Assignees
Labels

Comments

@lwansbrough
Copy link

I'd like to remove a user (all their connections) from a Signalr group without requiring their client's interaction. (For instance: kicking a user from a party/room.)

I recognize that I have a couple tools at my disposal:

IHubContext.Groups.RemoveFromGroupAsync(string connectionId, string groupName)
and
SignalR.Orleans.Core.HubContext.Group(groupName)

But neither the former nor the latter allow me to address a user by their user ID. How can I accomplish this?

One option I considered was getting all of a user's connection IDs, and iterating over RemoveFromGroupAsync, however the ConnectionGrain doesn't expose a method for getting the current connection IDs for a user/group.

@lwansbrough
Copy link
Author

The same argument could be made for adding a user to a group from the backend. Right now, the only way to add a user to a group is to have their client send a request to the signalr hub. Ideally, I would be able to obtain a reference to the group and add the user by user ID.

I realize this is slightly outside the capability of Signalr, because Signalr assumes that a backplane doesn't know where on the cluster the user's connection is, but Orleans does know, so I think it's a reasonable extension for this particular backplane.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants