Saving in database issue
when I am using this statement to send messages to client side to specific connection ids :
await _chatHubContext.Clients.Clients(connectionsIds).SendMessageToAgent(message);
it's not saving any data in the database
but when use this will all : await _chatHubContext.Clients.All.SendMessageToAgent(message);
it's saving data in the database, why this issue and how to solve it, here is my configuration :
services.AddSignalR()
.AddSqlServer(options =>
{
options.ConnectionString = Configuration.GetConnectionString("DefaultConnection");
options.AutoInstallSchema = true;
options.AutoEnableServiceBroker = true;
})
.AddJsonProtocol(options => { options.PayloadSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; });
This is intended - messages directed to a specific connection, if that connection is connected to the server that is sending the message, are sent directly to that connection and do not need to transit through the database.