1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-14 14:17:35 -05:00

signalr redis support. remove old azure signalr refs

This commit is contained in:
Kyle Spearrin
2020-03-04 21:57:42 -05:00
parent 7b91fe55f0
commit c8d7f04826
3 changed files with 13 additions and 20 deletions

View File

@ -57,9 +57,13 @@ namespace Bit.Notifications
MessagePack.Resolvers.ContractlessStandardResolver.Instance
};
});
if(!string.IsNullOrWhiteSpace(globalSettings.Notifications?.AzureSignalRConnectionString))
if(!string.IsNullOrWhiteSpace(globalSettings.Notifications?.RedisConnectionString))
{
signalRServerBuilder.AddAzureSignalR(globalSettings.Notifications.AzureSignalRConnectionString);
signalRServerBuilder.AddStackExchangeRedis(globalSettings.Notifications.RedisConnectionString,
options =>
{
options.Configuration.ChannelPrefix = "Notifications";
});
}
services.AddSingleton<IUserIdProvider, SubjectUserIdProvider>();
services.AddSingleton<ConnectionCounter>();
@ -105,25 +109,14 @@ namespace Bit.Notifications
app.UseAuthentication();
app.UseAuthorization();
// Add SignlarR
var useAzureSignalR = !string.IsNullOrWhiteSpace(
globalSettings.Notifications?.AzureSignalRConnectionString);
if(useAzureSignalR)
{
app.UseAzureSignalR(routes => routes.MapHub<NotificationsHub>("/hub"));
}
// Add endpoints to the request pipeline.
app.UseEndpoints(endpoints =>
{
if(!useAzureSignalR)
endpoints.MapHub<NotificationsHub>("/hub", options =>
{
endpoints.MapHub<NotificationsHub>("/hub", options =>
{
options.ApplicationMaxBufferSize = 2048; // client => server messages are not even used
options.TransportMaxBufferSize = 4096;
});
}
options.ApplicationMaxBufferSize = 2048; // client => server messages are not even used
options.TransportMaxBufferSize = 4096;
});
endpoints.MapDefaultControllerRoute();
});
}