packages feed

wss-client 0.2.1.1 → 0.3.0.0

raw patch · 3 files changed

+33/−27 lines, 3 filesdep ~websocketsPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: websockets

API changes (from Hackage documentation)

- Network.WebSockets.Client: forkPingThread :: Connection -> Int -> IO ()
+ Network.WebSockets.Client: withPingThread :: () => Connection -> Int -> IO () -> IO a -> IO a

Files

src/Network/WebSockets/Client.hs view
@@ -37,7 +37,7 @@   , WS.ConnectionException (..)      -- ** Utilities-  , WS.forkPingThread+  , WS.withPingThread   ) where  
test/Network/WebSockets/ClientSpec.hs view
@@ -1,9 +1,11 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-}  module Network.WebSockets.ClientSpec-  ( main-  , spec-  ) where+    ( main+    , spec+    )+where   import           Control.Applicative        (empty, (<|>))@@ -14,7 +16,7 @@ import           Test.Hspec import           Text.Read                  (readMaybe) -import qualified Network.WebSockets.Client as WS+import qualified Network.WebSockets.Client  as WS   -- `main` is here so that this module can be run from GHCi on its own.  It is@@ -26,30 +28,35 @@ newtype PortNumber = PortNumber Int deriving (Eq, Show)  instance FromEnv PortNumber where+#if MIN_VERSION_envy(2, 0, 0)+  fromEnv _ = do+#else   fromEnv = do+#endif     mpn <- (readMaybe <$> env "WSS_CLIENT_TEST_SERVER_PORT") <|> pure (Just 8614)     PortNumber <$> maybe empty pure mpn   spec :: Spec spec = describe "withConnection" $ do-  Right (PortNumber pn) <- runIO decodeEnv+    PortNumber pn <- runIO $ either fail return =<< decodeEnv -  let host = "localhost"-  server <- runIO $ Skews.start $ Skews.Args host pn+    let host = "localhost"+    server <- runIO $ Skews.start $ Skews.Args host pn -  let withConnection = WS.withConnection ("ws://" ++ host ++ ":" ++ show pn)-      payload = "response"-      response = WS.DataMessage False False False (WS.Binary payload)-      beforeAction = do-        Skews.reinit server-        Skews.setDefaultResponse server payload+    let withConnection = WS.withConnection ("ws://" ++ host ++ ":" ++ show pn)+        payload        = "response"+        response       = WS.DataMessage False False False (WS.Binary payload)+        beforeAction   = do+            Skews.reinit server+            Skews.setDefaultResponse server payload -  before_ beforeAction $-    it "can send and receive messages via the connection" $ do-      actualResponse <- withConnection $ \conn -> do-        WS.sendTextData conn ("client data" :: T.Text)-        r <- WS.receive conn-        WS.sendClose conn ("Bye" :: BS.ByteString)-        return r-      actualResponse `shouldBe` response+    before_ beforeAction+        $ it "can send and receive messages via the connection"+        $ do+              actualResponse <- withConnection $ \conn -> do+                  WS.sendTextData conn ("client data" :: T.Text)+                  r <- WS.receive conn+                  WS.sendClose conn ("Bye" :: BS.ByteString)+                  return r+              actualResponse `shouldBe` response
wss-client.cabal view
@@ -1,13 +1,12 @@ name:                wss-client-version:             0.2.1.1+version:             0.3.0.0 synopsis:            A-little-higher-level WebSocket client. description:         A-little-higher-level WebSocket client. Based on http-client and http-client-tls.-homepage:            https://github.com/iij-ii/wss-client+homepage:            https://github.com/iij-ii/direct-hs/tree/master/wss-client license:             BSD3 license-file:        LICENSE author:              Yuji Yamamoto maintainer:          yuji-yamamoto@iij.ad.jp-copyright:           2018 Yuji Yamamoto category:            Network build-type:          Simple extra-source-files:  README.md@@ -26,7 +25,7 @@                      , http-client >= 0.5.13                      , http-client-tls                      , network-uri-                     , websockets >= 0.12.0 && < 0.13+                     , websockets >= 0.12.6 && < 0.13   default-language:    Haskell2010  executable wss-client-sample@@ -59,4 +58,4 @@  source-repository head   type:     git-  location: https://github.com/iij-ii/wss-client+  location: https://github.com/iij-ii/direct-hs