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
| Key | Description |
|---|
ConnectionStrings:PostgresMigrator | Owner role (dotwire). Used to run migrations and apply startup retention. |
ConnectionStrings:PostgresWrite | Runtime role (dotwire_app) for writes. |
ConnectionStrings:PostgresRead | Runtime role for reads, including authorization checks and history. Can point at a replica. |
Postgres
| Key | Default | Description |
|---|
Postgres:Migrate | true | Run 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.
| Key | Default | Description |
|---|
Auth:Issuer | Required | Expected iss claim. |
Auth:Audience | Required | Expected 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:JwksRefreshMinutes | 5 | JWKS cache refresh interval. |
Auth:AllowInsecureJwksUrl | false | Allow a plain http JWKS URL on a non-loopback host. |
Auth:ClockSkewSeconds | 30 | Tolerance for exp, and for iat in the future. |
Auth:MaxTokenLifetimeMinutes | 60 | Tokens with exp - iat above this are rejected. 0 disables the cap. |
Node
| Key | Default | Description |
|---|
Dotwire:Role | All | All, Api, or Gateway. See Node roles. |
Dotwire:MaxContentBytes | 65536 | Maximum message content size in UTF-8 bytes. |
Dotwire:MaxRequestBodyBytes | 262144 | Maximum request body size. Larger requests get 413. |
Dotwire:MaxConnectionsPerUser | 100 | Hub plus SSE connections per user on one node. Above it, a hub connection is refused and SSE answers 429. 0 disables the cap. |
Dotwire:MembershipSweepSeconds | 60 | How often each gateway re-checks live subscriptions against current roles and membership. 0 disables the sweep. See Rooms and membership. |
CORS and hosts
| Key | Default | Description |
|---|
Cors:AllowedOrigins:<n> | Empty | Browser 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.
| Key | Default | Description |
|---|
Dotwire:Encryption:ActiveKeyId | Required | Key id new messages are encrypted under. Must name a configured key. |
Dotwire:Encryption:Keys:<id> | Required | Base64-encoded 32-byte AES key. Keep old ids configured after rotation. |
Dotwire:Encryption:AllowLegacyEnvelopes | true | Decrypt messages written before 0.3, which use the older envelope format. Set it to false once those rows have aged out. |
Retention
| Key | Default | Description |
|---|
Dotwire:Retention:MessagesDays | Unset | Postgres 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.
| Key | Default | Description |
|---|
Dotwire:Webhooks:Secret | Unset | When 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:AllowInsecureUrls | false | Allow plain http webhook URLs on a non-loopback host. |
Dotwire:Webhooks:Presend:Url | Unset | Presend call-out URL. Presend is off when unset. |
Dotwire:Webhooks:Presend:TimeoutMs | 500 | How long dotwire waits for an answer. |
Dotwire:Webhooks:Presend:FailPolicy | Closed | Closed fails the send with 503 presend_unavailable. Open accepts the original content. |
Dotwire:Webhooks:Presend:IncludeAdminSends | false | Also run presend for admin message injection. |
Dotwire:Webhooks:PostSend:Url | Unset | Postsend call-out URL. Postsend is off when unset. |
Dotwire:Webhooks:PostSend:TimeoutMs | 2000 | Timeout per delivery attempt. |
Dotwire:Webhooks:PostSend:MaxAttempts | 3 | Delivery attempts per message. |
Dotwire:Webhooks:PostSend:QueueCapacity | 1000 | Queue size. When full, the newest item is dropped with a warning. |
Dotwire:Webhooks:PostSend:MaxQueueBytes | 67108864 | Queue size in bytes (64 MiB). When exceeded, the newest item is dropped with a warning. |
Dotwire:Webhooks:PostSend:IncludeAdminSends | false | Also run postsend for admin message injection. |
SSE
See Stream room events.
| Key | Default | Description |
|---|
Dotwire:Sse:Enabled | true | When false, the events endpoint returns 404. |
Dotwire:Sse:KeepAliveSeconds | 15 | Interval between keep-alive comments. |
Dotwire:Sse:BufferSize | 256 | Events buffered per connection. A connection that falls further behind is closed. |
Dotwire:Sse:ReplayPageSize | 100 | Rows per page when replaying history on resume. |
Dotwire:Sse:MaxReplayRows | 1000 | Messages 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.
| Bucket | Keyed by | Covers | PermitLimit | TokensPerPeriod | PeriodSeconds |
|---|
Dotwire:RateLimits:Send | User | Member message sends | 20 | 5 | 1 |
Dotwire:RateLimits:Read | User | History, participants, hub and SSE connects, /audit | 30 | 10 | 1 |
Dotwire:RateLimits:Admin | User | Every /admin route | 200 | 50 | 1 |
Dotwire:RateLimits:Hub | User | Hub Subscribe and Unsubscribe | 30 | 10 | 1 |
Dotwire:RateLimits:Unauthenticated | Client IP | Every request without a valid token | 100 | 50 | 1 |
Dotwire:RateLimits:Enabled (default true) turns all buckets on or off. For example, Dotwire__RateLimits__Send__PermitLimit=40 doubles the send bucket.
NATS
| Key | Default | Description |
|---|
Nats:Url | nats://localhost:4222 | NATS server URL. Separate several URLs with commas. For an authenticated server, include the credentials: nats://<user>:<password>@host:4222. See Securing NATS. |
Nats:Enabled | true | Provision streams and run the NATS consumers at startup. |
Nats:RoomsStream | ROOMS | JetStream stream for room messages. |
Nats:RoomSubjectPrefix | room. | Prefix of each room's subject, room.{roomId}. |
Nats:RoomsSubjectFilter | room.* | Subject filter of the rooms stream. Don't widen it to room.>; see Ephemeral traffic. |
Nats:RoomLiveSubjectSuffix | .live | Suffix of the core subject used for live fanout. |
Nats:RoomsMaxAgeHours | 48 | How long the rooms stream keeps messages. |
Nats:BatchMaxMessages | 500 | Postgres writer: maximum messages per batch. |
Nats:BatchLingerMs | 1000 | Postgres writer: wait before flushing a partial batch. |
Nats:PostgresWriterConsumer | postgres-writer | Durable consumer name for the Postgres writer. |
Nats:AuditStream | AUDIT | JetStream stream for audit events. |
Nats:AuditSubject | audit.events | Subject for audit events. |
Nats:AuditWriterConsumer | audit-writer | Durable consumer name for the audit writer. |
Nats:AuditWriter:BatchMaxMessages | 200 | Audit writer: maximum events per fetch. |
Nats:AuditWriter:BatchLingerMs | 1000 | Audit writer: wait before flushing a partial batch. |
Nats:AuditWriter:StandbyRetrySeconds | 5 | How often a standby node retries for the audit writer lock. |
Runtime
compose.yaml sets these .NET runtime variables, which suit connection-dense workloads:
| Variable | Value | Effect |
|---|
DOTNET_gcServer | 1 | Server garbage collector. |
DOTNET_GCDynamicAdaptationMode | 1 | Dynamic adaptation of the server GC (DATAS). |