Namespace Virtufin.WebSocketManager.Services
Namespaces
Classes
- ApiLifecyclePublisher
Publishes connection lifecycle events to the virtufin-api's
system-eventstopic. Events are CloudEvents v1.0 envelopes with the WSM's URN as the source. The publisher is best-effort: failures are logged but never propagated, so an unreachable API does not break the WSM's local connection state machine.
- AppMetrics
Application-level metrics for the WebSocketManager service. Mirrors the pattern in
Virtufin.WorkManager.Services.AppMetrics. Counters are registered under the meterVirtufin.WebSocketManager, which is already wired into the OpenTelemetry pipeline inProgram.cs.
- ConnectionHeartbeatService
Periodically refreshes the state-store TTL on every locally-owned, connected WebSocket. The connection record's TTL was previously only refreshed by SendAsync(string, byte[], int, string, CancellationToken)/
SendRawAsync(traffic pushed to the socket) or by StartPublish/StopPublish -- a connection that is only receiving (the common case: subscribe once, then relay inbound messages to pub/sub) never touched its own record, so it deterministically expired from the state store ~TTL after the last StartPublish, independent of whether the socket was still alive. This heartbeat makes "record TTL" track "is the socket open on this pod" instead of "did traffic happen to flow through the touch paths."
- DaprCircuitBreakerHealthCheck
Health check that reports Dapr circuit breaker state.
- DaprResiliencePipeline
Provides resilience policies for Dapr operations with retry and circuit breaker.
- DaprStateStoreEntry
Represents a WebSocket connection entry stored in Dapr state store.
- DaprStateStoreEntryJsonConverter
Validates a deserialized DaprStateStoreEntry: throws InvalidOperationException if the persisted JSON is missing the required
InstanceIdfield. This funnels data-integrity errors to the deserialization boundary, where the connection ID is still identifiable, instead of letting null-carrying entries reach business logic that wraps every usage with a guard.
- DistributedWebSocketConnectionStore
Distributed implementation of IWebSocketConnectionStore that uses Dapr state store for persistence.
Interfaces
- IWebSocketConnectionStore
Interface for WebSocket connection storage.
- IWebSocketUrlValidator
SSRF prevention for caller-supplied WebSocket connection URLs. This service has no authentication of its own (cluster-internal network is the trust boundary for who may call it), but that says nothing about what the service itself can be tricked into doing -- an unvalidated
Connecttarget lets any caller direct outbound WebSocket traffic to arbitrary internal hosts, including cloud instance metadata endpoints. Mirrors virtufin-workmanager'sWorkManager.ValidateCodeSourceUrlAsync/IsPrivateIpAddress, which faces the identical risk shape for caller-supplied code-fetch URLs.