honojs / hono

Web framework built on Web Standards
https://hono.dev
MIT License
18.52k stars 522 forks source link

RPC support for SSE #3309

Open cybercoder-naj opened 3 weeks ago

cybercoder-naj commented 3 weeks ago

What is the feature you are proposing?

We require using EventSource to work with SSE routes, but can we have Hono's RPC to have this functionality as well?

const client = hc<typeof app>(`https://${BASE_URL}`)
client.sse.$get({
  onMessage(event) { /* do something with this */ },
  // other callbacks
}, {
  headers: {
    Authorization: 'Bearer booyah'
  }
})
yusukebe commented 2 weeks ago

This is super interesting.

@sor4chi @nakasyou @watany-dev @hagishi and others:

Any thoughts? Or can you work on it?

nakasyou commented 2 weeks ago

I think it is a good idea!

Also I thought, what do you think about typed JSON SSE? Now, SSE is used to stream LLM content. If we implement JSON SSE, development experience to create LLM app may get better.

yusukebe commented 2 weeks ago

JSON SSE

Great! As you mentioned, it is used in LLM apps often.