Skip to main content

feed_handler

Function feed_handler 

Source
pub async fn feed_handler(
    __arg0: State<Arc<NodeState>>,
    __arg1: Path<String>,
    __arg2: Query<FeedQuery>,
    headers: HeaderMap,
) -> impl IntoResponse
Expand description

Axum handler for GET /scp/broadcast/<routing_id>/feed.

Looks up the projected context by routing ID, queries stored blobs, deserializes each blob as a BroadcastEnvelope, decrypts it with the epoch-matched broadcast key, and returns the result as a JSON FeedResponse. Blobs that fail deserialization or decryption are logged and skipped (not a 500).

§Headers

  • Cache-Control: public, max-age=30, stale-while-revalidate=300
  • ETag: "<latest_blob_id_hex>" (the blob ID of the last message)

§Cursor expiry

When a since blob ID refers to a blob that has expired or been purged, the feed returns empty (no messages) rather than the full feed. Clients should treat an empty response to a previously-valid cursor as a signal to reset their cursor (omit since) and re-fetch from the beginning.

A since blob ID that belongs to a different context returns 400.

§Errors

  • 404 — Unknown routing ID (no projected context registered).
  • 400 — Invalid routing ID hex, invalid since blob ID hex, or since blob belongs to a different context.

See spec section 18.11.3.