You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a project I'm working on the SDK requires a onBlock callback that is called when new data comes in, to which I want to be able to send that data to a client with SSEs.
If we could have a similar api approach for a Hono ServerSentEventTarget baked into Context, that would open this connection and keep it open until otherwise closed (in a client disconnect event) that would be ideal.
I couldn't find a way to implement my above code with the current streamSSE since it requires a while loop to remain open.
What is the feature you are proposing?
I opened this discussion a while back (https://github.com/orgs/honojs/discussions/3472) to see if there were ways around the current streamSSE while loop for callback based SSE sending.
For a project I'm working on the SDK requires a
onBlock
callback that is called when new data comes in, to which I want to be able to send that data to a client with SSEs.See:
This model is heavily based on the Oak approach seen here: https://oakserver.github.io/oak/sse.html.
If we could have a similar api approach for a Hono ServerSentEventTarget baked into Context, that would open this connection and keep it open until otherwise closed (in a client disconnect event) that would be ideal.
I couldn't find a way to implement my above code with the current streamSSE since it requires a while loop to remain open.
@maou-shonen mentioned https://github.com/honojs/middleware/tree/main/packages/event-emitter however, it only works for inside the app, but its API is very ideal I would imagine for this feature.
The text was updated successfully, but these errors were encountered: