apiary-eventsource 0.17.0 → 1.0.0
raw patch · 2 files changed
+5/−4 lines, 2 filesdep ~apiary
Dependency ranges changed: apiary
Files
apiary-eventsource.cabal view
@@ -1,5 +1,5 @@ name: apiary-eventsource-version: 0.17.0+version: 1.0.0 synopsis: eventsource support for apiary web framework. description: example: <https://github.com/philopon/apiary/blob/master/examples/eventsource.hs>@@ -23,7 +23,7 @@ library exposed-modules: Web.Apiary.EventSource build-depends: base >=4.6 && <4.8- , apiary >=0.16 && <0.18+ , apiary >=1.0 && <1.1 , blaze-builder >=0.3 && <0.4 if flag(wai2apiary) build-depends: wai-eventsource >=2.0 && <3.0
src/Web/Apiary/EventSource.hs view
@@ -12,6 +12,7 @@ import qualified Network.Wai.EventSource.EventStream as E import Control.Concurrent.Chan (Chan, dupChan, readChan)+import Control.Monad.Apiary.Action import Data.Function @@ -41,14 +42,14 @@ #endif -- | eventsource with io action. since 0.11.3.-eventSourceIO :: Monad m => IO ServerEvent -> ActionT exts m ()+eventSourceIO :: Monad m => IO ServerEvent -> ActionT exts prms m () eventSourceIO io = do status status200 contentType "text/event-stream" stream $ ioToSource io -- | eventsource with chan. since 0.11.3.-eventSourceChan :: MonadIO m => Chan ServerEvent -> ActionT exts m ()+eventSourceChan :: MonadIO m => Chan ServerEvent -> ActionT exts prms m () eventSourceChan chan = do chan' <- liftIO $ dupChan chan eventSourceIO (readChan chan')