The websocket producer kept a single connection per instance in
`clients map[string]*websocket.Conn`. Registering a second subscriber
silently replaced the first, and `RemoveClient` deleted the whole instance
entry when either one disconnected. Consuming events in two browser tabs
therefore delivered to only the most recent one, and closing that tab cut
delivery for the remaining subscriber too.
Changes:
- `clients` becomes `map[string][]*client`. Deregistration now matches the
specific connection instead of removing the instance entry, so sibling
subscribers keep receiving events.
- Each connection carries its own write mutex. Events are dispatched from
independent goroutines (the `go CallWebhook` calls in the whatsmeow event
handler) and gorilla/websocket permits only one concurrent writer per
connection, so two simultaneous events could interleave writes on the
same socket.
- `Produce` snapshots the subscriber list under the read lock and performs
writes outside it, so a slow or half-open socket no longer blocks
deliveries for other instances.
- Failed writes prune the dead connection, and `Produce` now returns nil.
`sendToQueueOrWebhook` aborts the remaining producers when one returns an
error, so a closed browser tab previously suppressed RabbitMQ, NATS and
webhook delivery for that same event.
Verified with two concurrent subscribers on one instance: both receive
identical event streams, and disconnecting one leaves the other unaffected.
(cherry picked from commit 1db4408244fe75b39c2b4e1bbb8e681679dd7dae)
The Archive case asserts postMap["data"] to map[string]interface{}, but at that
point it still holds the raw *events.Archive. The assertion panics on every
archive event:
Event handler panicked while handling a *events.Archive:
interface conversion: interface {} is *events.Archive,
not map[string]interface {}
whatsmeow recovers the panic and logs it, so nothing crashes — the event simply
never reaches the webhook, silently.
Every other case in this switch marshals and unmarshals postMap["data"] into a
map before asserting. Archive was the only one missing that step. Six call sites
do the assertion; the other five are already guarded.
(cherry picked from commit 16c4be6e9a0ae8a0bbc41f8b2790a362a7a4e2e2)
whatsmeow was pinned to 2026-06-30 (v0.0.0-20260630180629-b572e5bcb92b),
which predates WhatsApp's minimum client version bump and causes
405 client-outdated connect failures.
- go.mau.fi/whatsmeow -> v0.0.0-20261102152715-54038813c47f
- go.mau.fi/util 0.9.10 -> 0.11.0, x/{crypto,net,sync,sys,text,tools} bumped
- go directive 1.25.0 -> 1.26.0 (upstream minimum), Dockerfile builder
golang:1.25.0-alpine -> golang:1.26.10-alpine
API adaptations:
- UpdateBlocklist/GetBlocklist now take a dhash argument
- SetStatusMessage takes types.SetStatusInput (text behind mex query)
Store schema upgrades to v16 (companion_meta_nonce, wasa_root_secret_id)
run automatically on container open; verified against a v14 sqlite auth DB.