Docs menu

You're reading the docs for dotwire 0.3. The latest release is 0.5. Upgrading? See Upgrading to 0.4.

Configuration

dotwire reads standard .NET configuration. As environment variables, replace each : with __, so Dotwire:Sse:Enabled becomes Dotwire__Sse__Enabled. For local runs with dotnet run, dotwire also loads a .env file.

Options without a default must be set. dotwire refuses to start if a required option is missing or invalid.

Connection strings

KeyDescription
ConnectionStrings:PostgresMigratorOwner role (dotwire). Used to run migrations and apply startup retention.
ConnectionStrings:PostgresWriteRuntime role (dotwire_app) for writes.
ConnectionStrings:PostgresReadRuntime role for reads, including authorization checks and history. Can point at a replica.

Postgres

KeyDefaultDescription
Postgres:MigratetrueRun the embedded migrations at startup. Set it on one node only.
Postgres:AppRolePassword—Password that the migration run sets for the dotwire_app role.

Auth

See Auth. Set Auth:Keys, Auth:JwksUrl, or both.

KeyDefaultDescription
Auth:IssuerRequiredExpected iss claim.
Auth:AudienceRequiredExpected aud claim.
Auth:Keys:<kid>—PEM-encoded RSA public key for key id <kid>, at least 2048 bits. Repeat for each key. A private key fails startup.
Auth:JwksUrl—JWKS endpoint to fetch public keys from. Must be https or a loopback host.
Auth:JwksRefreshMinutes5JWKS cache refresh interval.
Auth:AllowInsecureJwksUrlfalseAllow a plain http JWKS URL on a non-loopback host.
Auth:ClockSkewSeconds30Tolerance for exp, and for iat in the future.
Auth:MaxTokenLifetimeMinutes60Tokens with exp - iat above this are rejected. 0 disables the cap.

Node

KeyDefaultDescription
Dotwire:RoleAllAll, Api, or Gateway. See Node roles.
Dotwire:MaxContentBytes65536Maximum message content size in UTF-8 bytes.
Dotwire:MaxRequestBodyBytes262144Maximum request body size. Larger requests get 413.
Dotwire:MaxConnectionsPerUser100Hub plus SSE connections per user on one node. Above it, a hub connection is refused and SSE answers 429. 0 disables the cap.
Dotwire:MembershipSweepSeconds60How often each gateway re-checks live subscriptions against current roles and membership. 0 disables the sweep. See Rooms and membership.

CORS and hosts

KeyDefaultDescription
Cors:AllowedOrigins:<n>EmptyBrowser origins allowed to call dotwire, for example Cors__AllowedOrigins__0=https://app.example.com. Empty allows any origin. Credentials are never allowed.
AllowedHosts*Host names dotwire answers to, separated by semicolons. Set it to your real host names in production.

Encryption

See Encryption and retention.

KeyDefaultDescription
Dotwire:Encryption:ActiveKeyIdRequiredKey id new messages are encrypted under. Must name a configured key.
Dotwire:Encryption:Keys:<id>RequiredBase64-encoded 32-byte AES key. Keep old ids configured after rotation.
Dotwire:Encryption:AllowLegacyEnvelopestrueDecrypt messages written before 0.3, which use the older envelope format. Set it to false once those rows have aged out.

Retention

KeyDefaultDescription
Dotwire:Retention:MessagesDaysUnsetPostgres history retention in days, applied at startup by the node that runs migrations. Unset leaves the value last set through the admin API. Manage retention here or through the API, not both.

JetStream retention is Nats:RoomsMaxAgeHours, below.

Webhooks

See Moderation webhooks.

KeyDefaultDescription
Dotwire:Webhooks:SecretUnsetWhen set, both call-outs carry X-Dotwire-Timestamp, X-Dotwire-Signature-V2 and the legacy X-Dotwire-Signature. The host SDKs require it by default. See Signing.
Dotwire:Webhooks:AllowInsecureUrlsfalseAllow plain http webhook URLs on a non-loopback host.
Dotwire:Webhooks:Presend:UrlUnsetPresend call-out URL. Presend is off when unset.
Dotwire:Webhooks:Presend:TimeoutMs500How long dotwire waits for an answer.
Dotwire:Webhooks:Presend:FailPolicyClosedClosed fails the send with 503 presend_unavailable. Open accepts the original content.
Dotwire:Webhooks:Presend:IncludeAdminSendsfalseAlso run presend for admin message injection.
Dotwire:Webhooks:PostSend:UrlUnsetPostsend call-out URL. Postsend is off when unset.
Dotwire:Webhooks:PostSend:TimeoutMs2000Timeout per delivery attempt.
Dotwire:Webhooks:PostSend:MaxAttempts3Delivery attempts per message.
Dotwire:Webhooks:PostSend:QueueCapacity1000Queue size. When full, the newest item is dropped with a warning.
Dotwire:Webhooks:PostSend:MaxQueueBytes67108864Queue size in bytes (64 MiB). When exceeded, the newest item is dropped with a warning.
Dotwire:Webhooks:PostSend:IncludeAdminSendsfalseAlso run postsend for admin message injection.

SSE

See Stream room events.

KeyDefaultDescription
Dotwire:Sse:EnabledtrueWhen false, the events endpoint returns 404.
Dotwire:Sse:KeepAliveSeconds15Interval between keep-alive comments.
Dotwire:Sse:BufferSize256Events buffered per connection. A connection that falls further behind is closed.
Dotwire:Sse:ReplayPageSize100Rows per page when replaying history on resume.
Dotwire:Sse:MaxReplayRows1000Messages replayed per connection on resume. Past it, the stream ends and the client resumes again with Last-Event-ID.

Rate limits

See Rate limits. Each bucket has three settings: PermitLimit (bucket size), TokensPerPeriod (tokens added each period), and PeriodSeconds.

BucketKeyed byCoversPermitLimitTokensPerPeriodPeriodSeconds
Dotwire:RateLimits:SendUserMember message sends2051
Dotwire:RateLimits:ReadUserHistory, participants, hub and SSE connects, /audit30101
Dotwire:RateLimits:AdminUserEvery /admin route200501
Dotwire:RateLimits:HubUserHub Subscribe and Unsubscribe30101
Dotwire:RateLimits:UnauthenticatedClient IPEvery request without a valid token100501

Dotwire:RateLimits:Enabled (default true) turns all buckets on or off. For example, Dotwire__RateLimits__Send__PermitLimit=40 doubles the send bucket.

NATS

KeyDefaultDescription
Nats:Urlnats://localhost:4222NATS server URL. Separate several URLs with commas. For an authenticated server, include the credentials: nats://<user>:<password>@host:4222. See Securing NATS.
Nats:EnabledtrueProvision streams and run the NATS consumers at startup.
Nats:RoomsStreamROOMSJetStream stream for room messages.
Nats:RoomSubjectPrefixroom.Prefix of each room's subject, room.{roomId}.
Nats:RoomsSubjectFilterroom.*Subject filter of the rooms stream. Don't widen it to room.>; see Ephemeral traffic.
Nats:RoomLiveSubjectSuffix.liveSuffix of the core subject used for live fanout.
Nats:RoomsMaxAgeHours48How long the rooms stream keeps messages.
Nats:BatchMaxMessages500Postgres writer: maximum messages per batch.
Nats:BatchLingerMs1000Postgres writer: wait before flushing a partial batch.
Nats:PostgresWriterConsumerpostgres-writerDurable consumer name for the Postgres writer.
Nats:AuditStreamAUDITJetStream stream for audit events.
Nats:AuditSubjectaudit.eventsSubject for audit events.
Nats:AuditWriterConsumeraudit-writerDurable consumer name for the audit writer.
Nats:AuditWriter:BatchMaxMessages200Audit writer: maximum events per fetch.
Nats:AuditWriter:BatchLingerMs1000Audit writer: wait before flushing a partial batch.
Nats:AuditWriter:StandbyRetrySeconds5How often a standby node retries for the audit writer lock.

Runtime

compose.yaml sets these .NET runtime variables, which suit connection-dense workloads:

VariableValueEffect
DOTNET_gcServer1Server garbage collector.
DOTNET_GCDynamicAdaptationMode1Dynamic adaptation of the server GC (DATAS).