Event stream (Server-Sent Events)
GET
/eventsRequires: Cookie fret_session / Bearer
First event hello ({version}), then each event under its type, with as data
{id, type, at, data}:
| Type | data |
|---|---|
queue.state |
QueueState |
queue.reordered |
{} (reload the dock) |
package.updated |
Package |
package.removed |
{id} |
package.stored |
{id} (the shipment left the dock for the warehouse) |
file.updated |
File |
file.removed |
{id, packageId} |
progress |
Progress (4 times per second during transfers) |
A : ping comment every 25 s keeps the connection open.
Responses
200Event streamstring
text/event-stream
Request
curl "http://localhost:8080/api/v1/events" \ -H "Authorization: Bearer $TOKEN"const response = await fetch('http://localhost:8080/api/v1/events', { headers: { Authorization: 'Bearer <TOKEN>', },});console.log(response.status);import requests
response = requests.get( "http://localhost:8080/api/v1/events", headers={ "Authorization": "Bearer <TOKEN>", },)response.raise_for_status()print(response.status_code)