Open the server-sent events stream
Access: Access token in the Authorization header, or in the token query parameter.
Opens a long-lived Server-Sent Events connection for the authenticated user. The response is 200 with Content-Type: text/event-stream, Cache-Control: no-cache, Connection: keep-alive and X-Accel-Buffering: no, and it never completes. The first frame is a connected event whose data is { userId, timestamp }. Every 30 seconds the server writes the comment line :heartbeat to keep proxies from closing the connection (comments do not fire EventSource handlers). A user may hold several connections at once; each receives every event. Events delivered on this stream: booking:updated ({ bookingId, propertyId, status, type }, sent to both tenant and landlord when a booking is confirmed or cancelled), notification:new (only from POST /api/v1/stream/notify) and notification:system (no route sends it at the moment). The platform's regular notifications (notifications:new), chat events and escrow:status_updated are not sent over SSE; they are Socket.IO only. The token is checked once, when the connection opens; the stream stays open after the token expires. The client registry is in process memory, so delivery assumes a single server instance. An open stream also counts as "online", which suppresses the push and email fallbacks for chat messages.
Auth: this route uses the streamAuth middleware, not authenticateUser (which is why the generated spec shows it as public). It requires a valid access token, taken from Authorization: Bearer <token> or, if that header is absent, from the ?token= query parameter. streamAuth only verifies the JWT signature and expiry: it does not load the user from the database, so it does not notice deleted or deactivated accounts, and it sets the request's role to the placeholder user, so no stream route authorizes on role. Its failures use their own body shape, { success: false, error }, not the standard error envelope.
AuthorizationBearer <JWT>Access token returned by sign-in. Send it as Authorization: Bearer <token>.
token?stringJWT access token. Use this when the client cannot set headers (browser EventSource); otherwise send Authorization: Bearer <token>. One of the two is required.
Stream opened. The body is an endless text/event-stream, not JSON; the example shows the first frame, a heartbeat comment and a later event.
response?stringtext/event-streamcurl -X GET 'http://localhost:4000/api/v1/stream/events'"event: connected\ndata: {\"userId\":\"665f1c2e9b1d4a0012ab34c4\",\"timestamp\":\"2026-06-05T14:02:10.107Z\"}\n\n:heartbeat\n\nevent: booking:updated\ndata: {\"bookingId\":\"6660a7d49b1d4a0012ab3590\",\"propertyId\":\"665f1c2e9b1d4a0012ab34cd\",\"status\":\"confirmed\",\"type\":\"reservation\"}\n\n"
HomeLink Hub