ResearchCave Technology

ResearchCave.LiveExchangeRates.AspNetCore (1.0.0)

Published 2026-10-12 19:37:18 +03:00 by admin

Installation

dotnet nuget add source --name ResearchCave --username your_username --password your_token https://git.researchcave.com/api/packages/ResearchCave/nuget/index.json
dotnet add package --source ResearchCave --version 1.0.0 ResearchCave.LiveExchangeRates.AspNetCore

About this package

Live exchange rate subscriptions on a host application's existing SignalR hub.

Live exchange rates on an existing SignalR hub

This package adapts the collector's Redis snapshots and Pub/Sub notifications to an application-owned hub. It creates no hub, endpoint, authentication scheme or browser connection. The host retains its authorization and SignalR configuration.

Register the adapter after registering the application's singleton Redis connection:

services.AddLiveExchangeRateRealtime<EventHub>(new RedisRateOptions
{
    Key = "researchcave:live-exchange-rates:v1:snapshot",
    Database = 0
});

Forward UpdateLiveRateSubscriptions(LiveRatePair[]? pairs) from the existing authorized hub to ILiveRateSubscriptions<EventHub>.UpdateAsync(Context.ConnectionId, pairs, Context.ConnectionAborted). On disconnect call Remove(Context.ConnectionId). Never accept a caller-supplied connection ID. Keep the application's existing actor policy; Sentient restricts its EventHub to ResearchCave.HumanUser.

The browser receives ResearchCaveLiveRatesChanged. Use the helper shipped by ResearchCave.Browser.Client with the application's existing connection. No additional SignalR route or connection is needed.

Each application process shares one snapshot cache and Redis subscription. It reads the current snapshot on initial demand or Redis recovery, then consumes pushed snapshots. Timers only coalesce events and expire cached quotes; they never poll Redis. Defaults: updates no faster than three seconds, maximum source age thirty seconds, eight pairs per connection. LiveRateRealtimeOptions controls these bounds. Missing, malformed, disconnected or expired quotes return Available = false. Unknown symbols remain subscribed so a newly added collector source can appear without a new request.

RedisRateOptions.UpdatesChannel defaults to the snapshot key plus :updates. The collector and consumers must use the same key, database and channel. Channels are not database-scoped, so use distinct keys/channels for independent environments. Redeploy the updated collector to enable notifications; snapshot-only collectors provide the initial value but cannot push changes.

Sentient uses ConnectionStrings:Redis by default. Set LiveExchangeRates:Redis:ConnectionString to use a separate collector Redis instance; LiveExchangeRates:Redis:Key, Database and UpdatesChannel override the defaults. LiveExchangeRates:Realtime:MinimumUpdateInterval and MaximumAge accept TimeSpan values such as 00:00:03 and 00:00:30. If neither Redis connection is configured, the optional equivalent stays hidden. TBT/USD requires a real collector source; there is no assumed USD peg.

These values are indicative display equivalents. Purchasing still uses the application's original amount, currency and payment validation.

Dependencies

ID Version Target Framework
ResearchCave.LiveExchangeRates.Client 1.0.0 net10.0
Details
NuGet
2026-10-12 19:37:18 +03:00
2
ResearchCave.LiveExchangeRates.AspNetCore
25 KiB
Assets (2)
Versions (1) View all
1.0.0 2026-10-12