ResearchCave.Presence (1.1.48)
Installation
dotnet nuget add source --name ResearchCave --username your_username --password your_token http://git.researchcave.com/api/packages/ResearchCave/nuget/index.jsondotnet add package --source ResearchCave --version 1.1.48 ResearchCave.PresenceAbout this package
Fast, distributed ASP.NET Core presence recording and snapshots for ResearchCave services using Redis or Microsoft Garnet.
ResearchCave.Presence
Distributed, failure-tolerant presence recording for ASP.NET Core microservices.
It supports Redis and Microsoft Garnet through StackExchange.Redis.
builder.Services.AddResearchCavePresence(
builder.Configuration,
options =>
{
options.ServiceName = "Sentient";
options.ConnectionStringName = "Redis";
options.KeyPrefix = "presence";
options.UpdateInterval = TimeSpan.FromSeconds(30);
options.PresenceTtl = TimeSpan.FromMinutes(2);
options.MaximumUserAgentLength = 512;
});
Configure the shared connection in the standard configuration location:
{
"ConnectionStrings": {
"Redis": "localhost:6379"
}
}
When neither the named connection string nor an application-registered
IConnectionMultiplexer is available, presence is disabled, startup logs one warning,
HTTP requests continue normally, and snapshots are empty.
Place public static-file handling before presence, and presence after authentication:
app.UseStaticFiles();
app.UseAuthentication();
app.UseAuthorization();
app.UseResearchCavePresence();
The default IP resolver uses only HttpContext.Connection.RemoteIpAddress. Applications
behind Cloudflare or another trusted proxy can replace IPresenceIpAddressResolver through
dependency injection after configuring their trusted proxy boundary.
Inject IPresenceService or PresenceService to obtain a best-effort snapshot of raw active
records. Authenticated results are session-aware, so one sub can appear more than once.
Profile lookup and grouping belong to the consuming service.