fastapi-stream-lease · local demo

One user. One stream. Two tabs.

Each SSE stream holds a Redis lease. Both panels share one HttpOnly session cookie, so Tab B is rejected with 429 until Tab A finishes or disconnects.

Active streams
0 / 20
Per session
1
Per network
2
Backend
checking...

Try this

  1. Open Tab A and let it stream.
  2. Open Tab B while A is running. It gets 429 from the per-session lease.
  3. Disconnect A or let it finish.
  4. Open B again. The slot is free.

Request path

rate limitper-IP guardper-session leaseSSE

The per-IP guard is set to 2 so two tabs can reach the session lease. A third session from the same network is rejected by the IP guard.

Tab A

First stream, holds the lease

idle
Tokens received 0 / 0 Last token —
Ready.

Tab B

Same cookie, same session

idle
Tokens received 0 / 0 Last token —
Ready.

What you are seeing