@@ -39,3 +39,18 @@ eventSourceAppIO src _ sendResponse =
3939 case eventToBuilder se of
4040 Nothing -> return ()
4141 Just b -> sendChunk b >> flush >> loop
42+
43+-- | Make a new WAI EventSource application with a handler that emits events.
44+--
45+-- @since 3.0.28
46+eventStreamAppRaw :: ((ServerEvent -> IO()) -> IO () -> IO ()) -> Application
47+eventStreamAppRaw handler _ sendResponse =
48+ sendResponse $ responseStream
49+ status200
50+ [(hContentType, "text/event-stream")]
51+ $ \sendChunk flush -> handler (sendEvent sendChunk) flush
52+ where
53+ sendEvent sendChunk event =
54+ case eventToBuilder event of
55+ Nothing -> return ()
56+ Just b -> sendChunk b