GET /v1/listen
Opens a Server-Sent Events (SSE) stream. Connected clients receive a message event for every notification sent to the project.
code
GET https://api.flushkit.dev/v1/listen
This endpoint is consumed automatically by the Flutter SDK. You only need to call it directly if you are building a custom client.
Authentication
Pass the API key as a query parameter:
code
GET https://api.flushkit.dev/v1/listen?apiKey=fk_live_••••••••••••
Response
200 OK — text/event-stream
The connection stays open indefinitely. Each notification is delivered as an SSE message event with a JSON payload:
code
data: {"title":"Deploy done","message":"v1.4.2 is live","backgroundColor":"#7C3AED","durationSeconds":4,"position":"top"}
The server sends a comment line (:) every 30 seconds as a keepalive:
code
: keepalive
Event fields
| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | null | optional | Notification title. Null if no title was provided. |
message | string | required | Notification message body. |
backgroundColor | string | required | Background color as a hex string (e.g. #7C3AED). |
durationSeconds | integer | required | Display duration in seconds. 0 means persistent. |
position | string | required | top or bottom. |
401 Unauthorized
json
{ "code": "UNAUTHORIZED", "message": "Invalid or missing API key." }
Connecting from JavaScript
js
const source = new EventSource(
'https://api.flushkit.dev/v1/listen?apiKey=fk_live_••••••••••••'
)
source.onmessage = (event) => {
const notification = JSON.parse(event.data)
console.log(notification.message)
}
source.onerror = () => {
console.warn('SSE connection lost — browser will reconnect automatically')
}
Browsers reconnect SSE streams automatically on disconnect. The EventSource API handles this without any extra code.