Dose APIs of opencode support session-level SSE event listener? #4500

Open
opened 2026-02-16 17:44:22 -05:00 by yindo · 0 comments
Owner

Originally created by @1169361410 on GitHub (Jan 9, 2026).

Originally assigned to: @thdxr on GitHub.

Question

It seems that I just noticed the APIs offer both global-level and project-level event listeners, such as /global/event and /event for subscribing to server-sent events (SSE). 

So I was wondering:

Is there a way to implement a workflow where a user sends an asynchronous prompt (e.g., via POST /session/{id}/prompt_async), and a backend worker/thread can directly listen to session-level events, filter events for that specific session ID, and then push the real-time generated updates back to the corresponding user’s session?

Specifically:
• Can the server or client maintain a long-running listener on /event (project level) or /global/event (global level) and, for each incoming SSE event, dispatch it only to the relevant session based on sessionID?
• Is there an established pattern for routing those session events back to the correct user instance (for example via WebSocket, callback, or SSE client)?
• Is this supported or recommended by the SDK or server design for real-time interactive usage?

Originally created by @1169361410 on GitHub (Jan 9, 2026). Originally assigned to: @thdxr on GitHub. ### Question It seems that I just noticed the APIs offer both global-level and project-level event listeners, such as /global/event and /event for subscribing to server-sent events (SSE).  So I was wondering: Is there a way to implement a workflow where a user sends an asynchronous prompt (e.g., via POST /session/{id}/prompt_async), and a backend worker/thread can directly listen to session-level events, filter events for that specific session ID, and then push the real-time generated updates back to the corresponding user’s session? Specifically: • Can the server or client maintain a long-running listener on /event (project level) or /global/event (global level) and, for each incoming SSE event, dispatch it only to the relevant session based on sessionID? • Is there an established pattern for routing those session events back to the correct user instance (for example via WebSocket, callback, or SSE client)? • Is this supported or recommended by the SDK or server design for real-time interactive usage?
yindo added the docs label 2026-02-16 17:44:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4500