packages feed

wai-websockets 3.0.0.1 → 3.0.0.2

raw patch · 2 files changed

+12/−12 lines, 2 filesdep −io-streamsdep ~websockets

Dependencies removed: io-streams

Dependency ranges changed: websockets

Files

Network/Wai/Handler/WebSockets.hs view
@@ -9,12 +9,13 @@  import              Data.ByteString                 (ByteString) import qualified    Data.ByteString.Char8           as BC+import qualified    Data.ByteString.Lazy            as BL import qualified    Data.CaseInsensitive            as CI import              Network.HTTP.Types              (status500) import qualified    Network.Wai                     as Wai import qualified    Network.WebSockets              as WS import qualified    Network.WebSockets.Connection   as WS-import qualified    System.IO.Streams               as Streams+import qualified    Network.WebSockets.Stream       as WS  -------------------------------------------------------------------------------- isWebSocketsReq :: Wai.Request -> Bool@@ -62,18 +63,19 @@               -> (ByteString -> IO ())               -> IO a runWebSockets opts req app src sink = do--    is <- Streams.makeInputStream $ do-        bs <- src-        return $ if BC.null bs then Nothing else Just bs-    os <- Streams.makeOutputStream (maybe (return ()) sink) >>= Streams.builderStream+    stream <- WS.makeStream+        (do+            bs <- src+            return $ if BC.null bs then Nothing else Just bs)+        (\mbBl -> case mbBl of+            Nothing -> return ()+            Just bl -> mapM_ sink (BL.toChunks bl))      let pc = WS.PendingConnection                 { WS.pendingOptions     = opts                 , WS.pendingRequest     = req                 , WS.pendingOnAccept    = \_ -> return ()-                , WS.pendingIn          = is-                , WS.pendingOut         = os+                , WS.pendingStream      = stream                 }      app pc
wai-websockets.cabal view
@@ -1,5 +1,5 @@ Name:                wai-websockets-Version:             3.0.0.1+Version:             3.0.0.2 Synopsis:            Provide a bridge betweeen WAI and the websockets package. License:             MIT License-file:        LICENSE@@ -24,8 +24,7 @@                    , case-insensitive   >= 0.2                    , network            >= 2.2.1.5                    , transformers       >= 0.2-                   , websockets         >= 0.8-                   , io-streams         >= 1.1      && < 1.2+                   , websockets         >= 0.9                    , http-types   Exposed-modules:   Network.Wai.Handler.WebSockets   ghc-options:       -Wall@@ -46,7 +45,6 @@                    , network                    , text                    , file-embed-                   , io-streams                    , http-types   else     buildable: False