Path: redb-route/redb.Route.WebSocket/WsConnectionFactory.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.WebSocket/WsConnectionFactory.cs ---- using redb.Route.Abstractions; using redb.Route.Core; namespace redb.Route.WebSocket; /// /// Named connection factory for WebSocket. Register it in the route registry and reference it by /// name from the endpoint URI (connectionFactory=my-ws) so the TLS certificate password /// never has to appear in the URI, and therefore can never reach logs, telemetry, or the dashboard. /// /// The listen/target address stays in the endpoint path — a factory carries TLS material and /// timeouts only and can never silently redirect a route. Note the wss scheme still forces /// TLS on regardless of what the factory says. /// /// public sealed class WsConnectionFactory { /// Serve/connect over TLS. public bool Ssl { get; set; } /// Path to the PFX certificate. public string? SslCertPath { get; set; } /// Password for the PFX certificate. [Sensitive] public string? SslCertPassword { get; set; } /// Connect timeout in milliseconds. public int ConnectTimeout { get; set; } = 10_000; /// /// Copies this factory's TLS and timeout settings onto the endpoint options, but only for /// parameters the endpoint URI did not set explicitly — an inline URI value always wins. /// internal void ApplyTo(WsEndpointOptions options, EndpointUri uri) { var supplied = uri.RawParameters; if (!supplied.ContainsKey(nameof(options.Ssl))) options.Ssl = Ssl; if (!supplied.ContainsKey(nameof(options.SslCertPath))) options.SslCertPath = SslCertPath; if (!supplied.ContainsKey(nameof(options.SslCertPassword))) options.SslCertPassword = SslCertPassword; if (!supplied.ContainsKey(nameof(options.ConnectTimeout))) options.ConnectTimeout = ConnectTimeout; } }