Overview
wss://router.raze.bot/swap/sol/quote/stream keeps a quote fresh for you. Open one
socket, subscribe to a pair and an amount, and the router pushes a new quote
whenever on-chain state under the current route moves — no polling loop.
Re-quotes are event-driven: the ingest taps wake a subscription the moment a
transaction touches one of its route’s pools, so a push lands right after the fill
that moved the price. A slower fallback re-quote still runs underneath so a route can
shift onto pools the watch set doesn’t cover yet (a fresh pool, a warming index).
Because
data is the identical shape, a front-end can reuse its REST parsing
verbatim — including routes[], splitLegs[] and routeTicket, which is
redeemable at /swap/sol/instructions and /swap/sol/buy exactly like a polled one.code: "AUTH_REQUIRED") before
the socket opens.
Client frames
subscribe
Re-sending
subscribe with a live id replaces that subscription atomically —
this is how you edit an amount without a gap.
unsubscribe / ping
Server frames
seq increments per subscription, so you can drop out-of-order or duplicated frames
without tracking timestamps.
Push semantics
- Pushes are deduped on a route fingerprint (amounts + pools + hop set). An unchanged quote is re-sent only on the ~5 s heartbeat — so a repeat frame means “fresh and flat”, and silence past the heartbeat means the stream is stalled, not that the price stopped moving.
- The fallback re-quote runs about every 400 ms (≈ slot cadence) even with no wake.
- A
no_routeis likewise emitted once on transition, then only on the heartbeat.
