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 own SSE() BIF — confirmed directly that it isn't callable from a BoxExpress route handler at all (Function [SSE] not found), since it lives in the boxlang-web-support runtime module that BoxExpress doesn't load (BoxExpress implements its own HTTP layer directly against Undertow instead). res.sse()'s emitter.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 as emitter.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 own res.sse() callback — each funnels through the same per-emitter lock so two writers can't interleave and corrupt the SSE framing on the shared OutputStream; confirmed under real concurrent load (5 threads, 125 writes, zero malformed/duplicated frames). See SseEmitter.bx and the Server-Sent Events docs.