DotNetify-ResiliencyAddon allows dotNetify server to be more resilient when serving as an HTTP integration backend to an external Websocket API gateway. When configured with a distributed cache such as Redis, existing connections will be able to survive a server restart. Any active view model instance will be recreated and can resume its activities with connected clients when the server is restored.
Add the following library from NuGet: DotNetify.ResiliencyAddon.
Add the following in the Startup.cs:
using DotNetify.WebApi;
...
public void ConfigureServices(IServiceCollection services)
{
...
services.AddDotNetify();
services.AddDotNetifyIntegrationWebApi();
services.AddDotNetifyResiliencyAddon();
services.AddStackExchangeRedisCache(options => options.Configuration = builder.Configuration["Redis:ConnectionString"]);
...
}
public void Configure(IApplicationBuilder app)
{
...
app.UseDotNetify();
app.UseDotNetifyResiliencyAddon();
...
}