# Functional Delta: 006 Messaging NATS Replacement

> For the complete documentation index, see [llms.txt](https://deploy-preview-472--lucky-concha-f3599f.netlify.app/llms.txt).

Parent state: `005-postgres-database-replacement`

## Added

*   Broker-backed subject contract for backend event publication/consumption.
*   Broker-backed websocket stream path for frontend subscriptions.

## Changed

*   Trade messaging transport changes:
    *   from Socket.IO channels in `trade-feed`,
    *   to NATS subjects in `nats-broker`.
*   Event producer/consumer client logic in trade-service, trade-processor, and frontend stream subscriber.
*   Frontend realtime position handling keeps baseline aggregate blotter semantics by upserting rows for existing securities.

## Removed

*   Dedicated Socket.IO messaging service role (`trade-feed`) in target runtime topology.

## Flow Impact

*   [`F2`](https://deploy-preview-472--lucky-concha-f3599f.netlify.app/specs/baseline-uncontainerized-parity/system/end-to-end-flows.md#f2-bootstrap-trade--position-blotters) (trade submission and processing): publish/consume path changes to NATS.
*   [`F4`](https://deploy-preview-472--lucky-concha-f3599f.netlify.app/specs/baseline-uncontainerized-parity/system/end-to-end-flows.md#f4-process-trade-events) (real-time blotter updates): subscription path changes to NATS WebSocket.
*   Startup sequencing and health checks include NATS broker readiness.
