docs: update README, CONFIG, EXTEND for config/dialer refactoring

This commit is contained in:
Jay
2026-05-26 15:08:33 -04:00
parent 8c1371e3a0
commit d04341bfa2
3 changed files with 18 additions and 9 deletions
+16 -6
View File
@@ -17,7 +17,7 @@ Logging can be controlled independently at the pool, worker, and connection leve
| Connection | `ErrorsBufferSize` | 10 | — | Must be positive |
| Connection | `LoggingEnabled` | true | `false` | |
| Connection | `LogLevel` | nil | — | nil defers to handler's own filter |
| Retry | enabled | yes | `WithoutRetry()` | Governs `Connect()` only |
| Retry | enabled | yes | `WithRetryDisabled()` | Governs `Connect()` only |
| Retry | `MaxRetries` | 0 | — | 0 means infinite |
| Retry | `InitialDelay` | 1s | — | Must be positive |
| Retry | `MaxDelay` | 60s | — | Must be ≥ InitialDelay |
@@ -61,11 +61,16 @@ Sets the capacity of the channel that buffers inbound messages between the reade
**`WithErrorsBufferSize(int)`**
Sets the capacity of the channel that carries connection-level errors to the consumer. Must be at least 1.
### Dialer
**`WithConnectionDialer(types.Dialer)`**
Overrides the dialer used to establish the WebSocket connection. When not set, the connection uses the default dialer. Useful in tests or when routing connections through a custom transport.
### Retry
The retry policy governs the `Connect()` call only. It does not affect worker reconnection, which is controlled by `ReconnectDelay` on the worker config.
**`WithoutRetry()`**
**`WithRetryDisabled()`**
Disables retry entirely. `Connect()` returns on the first dial failure.
**`WithRetryMaxRetries(int)`**
@@ -124,13 +129,18 @@ Enables or disables worker-level logging.
**`honeybee.WithWorkerLogLevel(slog.Level)`**
Overrides the minimum log level for worker-scoped records only.
### Per-connection
**`honeybee.WithDialer(types.Dialer)`**
Overrides the dialer for a single `Connect` call. Passed as a variadic option: `pool.Connect(id, honeybee.WithDialer(d))`. When provided, it takes precedence over the dialer resolved from `ConnectionConfig`. Existing callers that pass no options are unaffected.
### Wiring
**`honeybee.WithConnectionConfig(*transport.ConnectionConfig)`**
Supplies a connection config used when dialing each peer.
**`honeybee.WithConnectionConfig(transport.ConnectionConfig)`**
Supplies a connection config used when dialing each peer. Accepted by value; the pool stores its own copy.
**`honeybee.WithWorkerConfig(*honeybee.WorkerConfig)`**
Supplies a worker config applied to every worker the pool creates.
**`honeybee.WithWorkerConfig(honeybee.WorkerConfig)`**
Supplies a worker config applied to every worker the pool creates. Accepted by value; the pool stores its own copy.
**`honeybee.WithWorkerFactory(honeybee.WorkerFactory)`**
Replaces the default worker constructor. See [EXTEND.md](EXTEND.md) for the factory contract.
+1 -2
View File
@@ -35,8 +35,7 @@ type PoolPlugin struct {
Inbox chan<- honeybee.InboxMessage
Events chan<- honeybee.PoolEvent
InboxCounter *atomic.Uint64
Dialer honeybee.Dialer
ConnectionConfig *transport.ConnectionConfig
ConnectionConfig transport.ConnectionConfig
Handler slog.Handler
}
```
+1 -1
View File
@@ -240,7 +240,7 @@ Connections send periodic WebSocket ping frames and listen for the corresponding
Pong-derived heartbeats reset the keepalive timer alongside data messages and sends. A peer that sends no data but responds to pings will not be disconnected and reconnected by the keepalive mechanism.
The ping interval is configured via `transport.WithPingInterval` on the `transport.ConnectionConfig`. Import `git.wisehodl.dev/jay/go-honeybee/transport` to construct a `ConnectionConfig`, then pass it to the pool via `honeybee.WithConnectionConfig`, or supply it directly to `NewConnection` and `NewConnectionFromSocket`. The default is 20 seconds. Set to zero to disable pings entirely, in which case only data messages and outbound sends generate heartbeats.
The ping interval is configured via `transport.WithPingInterval` on the `transport.ConnectionConfig`. Import `git.wisehodl.dev/jay/go-honeybee/transport` to construct a `ConnectionConfig`, then pass it to the pool by value via `honeybee.WithConnectionConfig`, or supply it directly to `NewConnection` and `NewConnectionFromSocket`. The default is 20 seconds. Set to zero to disable pings entirely, in which case only data messages and outbound sends generate heartbeats.
## Statistics