Proactively create NATS consumer at session creation to prevent message loss

FixMediaService
Shipped
April 25, 2026 at 5:56 PM UTC
Author
Kamo
Commit
436811a

Previously the NATS JetStream push consumer was only created when a STOMP client sent /app/chat/subscribe. With DeliverPolicy.New, any messages published before a consumer exists are permanently lost — causing visitor messages and name changes to never appear in kamo-internal unless the agent happened to be subscribed first. - Extract NATS subscription logic into ChatSessionSubscriptionManager (idempotent ensureSubscription, fixes id serialized as String to avoid JS precision loss on CockroachDB unique_rowid IDs) - ChatWebSocketController delegates subscribeToSession() to the manager - PublicChatService calls ensureSubscription() immediately after creating the MediaSession (so the consumer exists before the first visitor message arrives) and again in sendSupportMessage() as a fallback

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing