Server-Sent Events
Realtime SSE
Subscribe to committed stock, faction, and token events with explicit filters.
Connect
fetch("https://compagnon-api.foxwar.net/api/events?events=stock.low,stock.critical&mapIds=DeadLandsHex&cityIds=ThePits&items=MaintenanceSupplies&minQuantity=20", {
headers: { Authorization: `Bearer ${token}` },
});
Use an SSE client that supports request headers. Native browser EventSource cannot send a bearer header.
| Event | Meaning |
|---|---|
stock.updated | Any committed quantity change. |
stock.removed | A public or reserve stockpile removed after seven days without an upload. Includes its last known content and remains access-filtered. |
stock.low | A positive quantity matching the subscriber threshold. |
stock.critical | A quantity reaching zero. |
faction.update | A stockpile control change. |
token.expire | An access token approaching expiry. |
Discord delivery
The Foxpile bot consumes a trusted stream. It buffers each event type for 25 seconds, deduplicates related items, applies guild routes, then creates one grouped notification with map pins and details.