hono
hono copied to clipboard
Export SSEMessage and SSEStreamingApi from hono/streaming
What is the feature you are proposing?
Currently hono/streaming
only exports streamSSE
. It would be nice to export SSEStreamingApi
and SSEMessage
so that we can write functions outside and not needing inlining the callback. For example:
const myStreamingLogic = async (stream: SSEStreamingApi) => {
// do business logic
}
in the handler:
const createMessageHandler = async (c: Context) => {
return streamSSE(c, myStreamingLogic)
}
StreamingAPI is exported like this, I see.
https://github.com/honojs/hono/blob/a8fb2377c90de6f216135a4bb3c2bd1704c1086f/src/utils/stream.ts#L1-L10
If it's acceptable, I can make the modifications. Are there any other opinions on this? @yusukebe @sor4chi
Hi, @watany-dev @donchev7
How about providing it as factory.createStreamHandler
and factory.createStreamSSEHandler
?
cc: @yusukebe
How about providing it as
factory.createStreamHandler
andfactory.createStreamSSEHandler
?
I don't think we need to go that far.
It' enough to just export SSEStreamingApi
and SSEMessage
.
This can be closed!