This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.32k
stars
4.66k
forks
source link
Queries about to One to One chat and same client Rejoing same group with previous chat #42315
I'm creating a chat application in .net Maui, I'm having queries about
1) Is It possible to send messages user-to-user (one-to-one) only
2) When the client closes the connection it's not triggering the event:-client.Disconnected += _ => { return Task.CompletedTask; };
3) while doing group chat if one user left the chat and he wants to rejoin the same group with the previous chat how can we do that?
Library name and version
Azure.Messaging.WebPubSub.Client v1.0.0
Query/Question
I'm creating a chat application in .net Maui, I'm having queries about 1) Is It possible to send messages user-to-user (one-to-one) only 2) When the client closes the connection it's not triggering the event:-
client.Disconnected += _ => { return Task.CompletedTask; };
3) while doing group chat if one user left the chat and he wants to rejoin the same group with the previous chat how can we do that?Environment
.net Maui (8.0) I'm providing some code snippets
`System.Globalization.CultureInfo.CurrentCulture.ClearCachedData(); Messages = new ObservableCollection();
var client = await EstablishConnectionAndHubAsync(token);
client.Connected += args =>
{
BadgeColor = Colors.Green;
UserId = args.UserId;
CancellationToken = args.CancellationToken;
ConnectionId = args.ConnectionId;
return Task.CompletedTask;
};
client.Disconnected += _ => { BadgeColor = Colors.Red; return Task.CompletedTask; };
client.ServerMessageReceived += args => { Console.WriteLine($"Received message: {args.Message.Data}"); return Task.CompletedTask; };
client.GroupMessageReceived += args => { Console.WriteLine($"Received message: {args.Message.Data}"); return Task.CompletedTask; };
// reconnect to the group
await client.StartAsync(cancellationToken: token); await client.JoinGroupAsync(GroupName, cancellationToken: token);`