# Stream session status Subscribe to real-time session status changes using Server-Sent Events (SSE). Opens a persistent SSE connection that delivers session status updates, participant join/leave events, and error notifications in real time. The response uses the `text/event-stream` content type and keeps the connection open until the session ends or the client disconnects. The server sends a keepalive comment (`: keepalive`) every 15 seconds to prevent proxy timeouts. When the session reaches a terminal state (`completed` or `failed`), a `close` event is sent and the stream ends. #### Path Parameters **`session_id`** string required The session identifier. Must start with `mbsess_`. #### Event Types **`status`** — Session status change Sent when the session transitions to a new status (e.g., `joining`, `active`, `completed`, `failed`). Also sent for participant join/leave events. | Field | Type | Description | | --- | --- | --- | | `session_id` | string | Session identifier | | `status` | string | New session status | | `previous_status` | string or null | Previous status | | `timestamp` | string | ISO 8601 timestamp | | `error_message` | string or null | Error description (if `failed`) | | `error_code` | string or null | Error code (if `failed`) | | `participant_name` | string | Participant name (for join/leave events only) | | `event` | string | `"joined"` or `"left"` (for join/leave events only) | **`close`** — Stream termination Sent when the session reaches a terminal state. The stream closes after this event. | Field | Type | Description | | --- | --- | --- | | `reason` | string | Always `"session_ended"` | ## Returns A `text/event-stream` response. Each event is formatted as: ``` event: data: ``` A keepalive comment is sent every 15 seconds: ``` : keepalive ``` Request ```bash cURL curl -N -H "Authorization: Bearer $ACCESS_TOKEN" \ "https://api.aitronos.com/v1/meeting-buddy/sessions/mbsess_abc123def456/stream" ``` ```python Python SDK from aitronos import Aitronos client = Aitronos(api_key="your-api-key") # Stream session status events for event in client.meeting_buddy.stream_session("mbsess_abc123def456"): if event.type == "status": data = event.data print(f"Status: {data['status']}") elif event.type == "close": print("Session ended") break ``` ```python Python import os import requests import json access_token = os.environ["ACCESS_TOKEN"] session_id = "mbsess_abc123def456" url = f"https://api.aitronos.com/v1/meeting-buddy/sessions/{session_id}/stream" headers = {"Authorization": f"Bearer {access_token}"} with requests.get(url, headers=headers, stream=True) as response: event_type = None for line in response.iter_lines(decode_unicode=True): if not line: event_type = None continue if line.startswith(":"): # Keepalive comment, ignore continue if line.startswith("event: "): event_type = line[7:] elif line.startswith("data: "): data = json.loads(line[6:]) if event_type == "status": print(f"Status: {data.get('status', data.get('event'))}") elif event_type == "close": print("Stream closed:", data["reason"]) break ``` ```javascript JavaScript const accessToken = process.env.ACCESS_TOKEN; const sessionId = 'mbsess_abc123def456'; const eventSource = new EventSource( `https://api.aitronos.com/v1/meeting-buddy/sessions/${sessionId}/stream`, { headers: { 'Authorization': `Bearer ${accessToken}` } } ); eventSource.addEventListener('status', (e) => { const data = JSON.parse(e.data); console.log('Status:', data.status || data.event); }); eventSource.addEventListener('close', (e) => { const data = JSON.parse(e.data); console.log('Stream closed:', data.reason); eventSource.close(); }); eventSource.onerror = (e) => { console.error('SSE error:', e); eventSource.close(); }; ``` Response ```text 200 OK (text/event-stream) event: status data: {"session_id":"mbsess_abc123def456","status":"joining","previous_status":"joining","timestamp":"2025-12-11T10:00:05Z","error_message":null,"error_code":null} : keepalive event: status data: {"session_id":"mbsess_abc123def456","status":"active","previous_status":"active","timestamp":"2025-12-11T10:00:30Z","error_message":null,"error_code":null} event: status data: {"session_id":"mbsess_abc123def456","participant_name":"Alice","event":"joined","timestamp":"2025-12-11T10:01:00Z"} event: status data: {"session_id":"mbsess_abc123def456","status":"completed","previous_status":"completed","timestamp":"2025-12-11T10:30:00Z","error_message":null,"error_code":null} event: close data: {"reason":"session_ended"} ``` ```json 404 Not Found { "success": false, "error": { "code": "SESSION_NOT_FOUND", "message": "Session not found", "type": "client_error", "status": 404, "details": { "session_id": "mbsess_abc123def456" }, "trace_id": "abc-123-def", "timestamp": "2025-12-11T10:00:00Z" } } ``` ```json 422 Validation Error { "success": false, "error": { "code": "INVALID_SESSION_ID_FORMAT", "message": "Invalid session_id format. Must start with 'mbsess_'", "type": "client_error", "status": 422, "details": { "session_id": "invalid_id" }, "trace_id": "abc-123-def", "timestamp": "2025-12-11T10:00:00Z" } } ``` ## Related Resources - [Stream Transcripts](/docs/api-reference/meeting-buddy/transcript-stream) - [Stream Logs](/docs/api-reference/meeting-buddy/log-stream) - [Start Session](/docs/api-reference/meeting-buddy/start-session) - [Get Session Details](/docs/api-reference/meeting-buddy/get-session) - [Stop Session](/docs/api-reference/meeting-buddy/stop-session) - [List Sessions](/docs/api-reference/meeting-buddy/list-sessions)