opencode icon indicating copy to clipboard operation
opencode copied to clipboard

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

Open 1169361410 opened this issue 1 week ago • 0 comments

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?

1169361410 avatar Jan 09 '26 09:01 1169361410