Azure SignalR API Add to Group
I have been using the Azure SignalR API just fine for sending messages to groups, everyone and single users.
I have a problem adding a user to a group though.
I execute the request as per https://docs.microsoft.com/en-us/azure/azure-signalr/signalr-quickstart-rest-api#add-user-to-group and while i get a success response, the user is not added to group.
var url = "xxx.service.signalr.net/api/v1/hubs/<hub-name>/groups/<group-name>/users/<userid>" var request = new HttpRequestMessage(HttpMethod.Put, _azureSignalRUtilities.GetUrl(url)); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", _azureSignalRUtilities.GenerateAccessToken(url, _serverName)); request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
I have copied the samples from https://github.com/aspnet/AzureSignalR-samples/tree/master/samples/Serverless
1 Answers Azure SignalR API Add to Group
With some changes to the samplea application and adding new methods to add/remove users from group, I am able to add/remove specific user to the group and send message to that group.
I have group name hardcoded in this sample as "TestGroup"
- only user "123" is added to group "TestGroup"
- Message is sent to group "TestGroup", it was received only by "123"
- User "123" is removed from the group.
- Message is again sent to Group but none of user is part of "TestGroup' and it was not received by any of users.
I have modified sample application to add 2 methods for this addusertogroup removeuserfromgroup also corrected "send group "
Note : I found that group name is case-sensitive
complete code is available in this repository https://github.com/rahulruikar/Serverless