Objective
Add a working SSE example to the product-catalog demo and document the pattern in the developer guide. This implements the documentation track defined in #6.
Prerequisite
Developer guide
Add a dedicated SSE section to docs/DEVELOPERS_GUIDE.md. Content defined in #6:
EventSource API basics (connect, listen, close, auto-reconnect)
- RESTHeart SSE endpoint format (
/_streams/<name>)
- Full working example using
EventSource + htmx.ajax() for re-rendering
- When to use SSE vs polling
- Auth considerations
- Guidance on high-frequency flows (client-side rendering, not SSR)
Product-catalog example
Wire one live update scenario in examples/product-catalog:
- Product list (
/shop/products) auto-refreshes when a product is inserted or deleted
- Uses native
EventSource connected to the RESTHeart change stream for the products collection
- On event: calls
htmx.ajax() to re-fetch and re-render the product list fragment
- Demonstrates at least one visible live DOM update without a page reload
Update examples/product-catalog/README.md with:
- Prerequisites (MongoDB replica set required for change streams)
- How to trigger a visible update (e.g. insert a document via curl or the admin UI)
Acceptance criteria
Objective
Add a working SSE example to the product-catalog demo and document the pattern in the developer guide. This implements the documentation track defined in #6.
Prerequisite
HtmlResponseInterceptorbypassesAccept: text/event-streamrequests (Core hardening: bypass HTML interceptor for SSE event-stream requests #8 ✅)Developer guide
Add a dedicated SSE section to
docs/DEVELOPERS_GUIDE.md. Content defined in #6:EventSourceAPI basics (connect, listen, close, auto-reconnect)/_streams/<name>)EventSource+htmx.ajax()for re-renderingProduct-catalog example
Wire one live update scenario in
examples/product-catalog:/shop/products) auto-refreshes when a product is inserted or deletedEventSourceconnected to the RESTHeart change stream for the products collectionhtmx.ajax()to re-fetch and re-render the product list fragmentUpdate
examples/product-catalog/README.mdwith:Acceptance criteria
EventSourcepattern documented with a complete working example