wai-eventsource 1.1.0.1 → 1.2.0
raw patch · 2 files changed
+9/−16 lines, 2 filesdep ~conduitdep ~waidep ~warp
Dependency ranges changed: conduit, wai, warp
Files
- src/Network/Wai/EventSource.hs +5/−12
- wai-eventsource.cabal +4/−4
src/Network/Wai/EventSource.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} module Network.Wai.EventSource ( ServerEvent(..),- eventSourceApp, eventSourceAppChan, eventSourceAppSource, eventSourceAppIO@@ -20,12 +19,6 @@ -- | Make a new WAI EventSource application reading events from -- the given channel.-eventSourceApp :: Chan ServerEvent -> Application-eventSourceApp = eventSourceAppChan-{-# DEPRECATED eventSourceApp "Use evnetSourceAppChan instead." #-}---- | Make a new WAI EventSource application reading events from--- the given channel. eventSourceAppChan :: Chan ServerEvent -> Application eventSourceAppChan chan _ = do chan' <- liftIO $ dupChan chan@@ -33,7 +26,7 @@ -- | Make a new WAI EventSource application reading events from -- the given source.-eventSourceAppSource :: C.Source IO ServerEvent -> Application+eventSourceAppSource :: C.Source (C.ResourceT IO) ServerEvent -> Application eventSourceAppSource src _ = return $ response sourceToSource src -- | Make a new WAI EventSource application reading events from@@ -41,10 +34,10 @@ eventSourceAppIO :: IO ServerEvent -> Application eventSourceAppIO act _ = return $ response ioToSource act -response :: (a -> C.Source IO (C.Flush Builder)) -> a -> Response+response :: (a -> C.Source (C.ResourceT IO) (C.Flush Builder)) -> a -> Response response f a = ResponseSource status200 [("Content-Type", "text/event-stream")] $ f a -chanToSource :: Chan ServerEvent -> C.Source IO (C.Flush Builder)+chanToSource :: Chan ServerEvent -> C.Source (C.ResourceT IO) (C.Flush Builder) chanToSource chan = C.sourceState Nothing pull where@@ -55,7 +48,7 @@ Just y -> C.StateOpen (Just C.Flush) (C.Chunk y) pull (Just x) = return $ C.StateOpen Nothing x -ioToSource :: IO ServerEvent -> C.Source IO (C.Flush Builder)+ioToSource :: IO ServerEvent -> C.Source (C.ResourceT IO) (C.Flush Builder) ioToSource act = C.sourceState Nothing pull where@@ -66,7 +59,7 @@ Just y -> C.StateOpen (Just C.Flush) (C.Chunk y) pull (Just x) = return $ C.StateOpen Nothing x -sourceToSource :: C.Source IO ServerEvent -> C.Source IO (C.Flush Builder)+sourceToSource :: Monad m => C.Source m ServerEvent -> C.Source m (C.Flush Builder) sourceToSource src = src $= CL.concatMap eventToFlushBuilder where eventToFlushBuilder event =
wai-eventsource.cabal view
@@ -1,5 +1,5 @@ Name: wai-eventsource-Version: 1.1.0.1+Version: 1.2.0 Synopsis: WAI support for server-sent events Description: WAI support for server-sent events License: BSD3@@ -17,10 +17,10 @@ base >= 4.3 && < 5 , bytestring >= 0.9.1.4 && < 0.10 , blaze-builder >= 0.3 && < 0.4- , conduit >= 0.2 && < 0.3+ , conduit >= 0.4 && < 0.5 , http-types >= 0.6 && < 0.7- , wai >= 1.1- , warp >= 1.1+ , wai >= 1.2 && < 1.3+ , warp >= 1.2 && < 1.3 , transformers ghc-options: -Wall