Usage
To use Flux, simply send a POST request to the /flux/{id}
endpoint with the data you want to stream, along with a Bearer token in the Authorization header.
The {id}
parameter is a unique identifier for the stream. You can use an EventSource
object to listen for updates on the stream at the /flux/{id}
endpoint.
Routes
POST /new
- Creates a new stream and responds with:id
- The unique identifier for the stream.key
- The Bearer token to use when updating the stream.
POST /flux/{id}
- Update the stream with the given ID (any data sent in the request body will be streamed to clients). The request must include thekey
as a Bearer token in the Authorization header.GET /flux/{id}?onFirst=true
- Listen for updates on the stream with the given ID.onFirst
(optional) - If set totrue
, the client will receive the last update sent to the stream when they connect.