boxlang-express 0.2.2
Released .
- Added
res.sse(callback)— Server-Sent Events, a long-lived one-way event stream to the client. Not a wrapper around BoxLang's ownSSE()BIF — confirmed directly that it isn't callable from a BoxExpress route handler at all (Function [SSE] not found), since it lives in theboxlang-web-supportruntime module that BoxExpress doesn't load (BoxExpress implements its own HTTP layer directly against Undertow instead).res.sse()'semitter.send()/comment()/close()/isClosed()API deliberately mirrors that BIF's shape anyway, since it's a proven design — just built from scratch against Undertow's raw exchange. Bypasses the normal buffered_end()path entirely (every other terminal method builds one byte array and sends it once; this writes incrementally asemitter.send()is called), and detects a client disconnect from a failed write rather than polling connection state.send()/comment()/close()are safe to call from more than one thread — a route handler broadcasting to an emitter stashed elsewhere, concurrently with the connection's ownres.sse()callback — each funnels through the same per-emitter lock so two writers can't interleave and corrupt the SSE framing on the sharedOutputStream; confirmed under real concurrent load (5 threads, 125 writes, zero malformed/duplicated frames). See SseEmitter.bx and the Server-Sent Events docs.