Bytewells by ThoughtPivot
Flight is ThoughtPivot's open-source web framework. Since 3.0.0 it ships flight-bun , a server that runs on Bun.serve and mounts existing Koa backends ( export default router.routes() ) through a Koa-compat layer. On Oct 18 we pushed 3.0.1 to main. It fixes one thing that matters a lot if you stream: Koa server-sent events (SSE) on flight-bun were buffered until res.end() . The client connected, the server wrote events, and nothing arrived until the stream closed.
The fix touched four separate parts of the stack. Each one was a reasonable choice for request-response traffic and a bug for a stream. This post walks through them, because the same four assumptions are probably sitting in your middleware too.
Commit: https://github.com/thoughtpivot/flight/commit/7db959993b20593e192fbeb599d164751c8ecaf1
The route we wanted to work
This is the usual way to stream from Koa. Nothing Bun-specific:
router . get ( ' /events ' , ( ctx ) => { ctx .…