packages feed

http-client-websockets 0.1.0.0 → 0.1.1.0

raw patch · 3 files changed

+23/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Network.HTTP.Client.WebSockets: runClientWithRequest :: Manager -> Request -> ConnectionOptions -> ClientApp a -> IO a

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for http-client-websockets +## 0.1.1.0 -- 2020-10-24++* Added `runClientWithRequest` ([#1](https://github.com/amesgen/http-client-websockets/pull/1) from @tvh).+ ## 0.1.0.0 -- 2020-09-28  * First version. Released on an uNsUsPeCtInG world.
http-client-websockets.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: http-client-websockets-version: 0.1.0.0+version: 0.1.1.0  synopsis: Glue code for http-client and websockets description:@@ -37,7 +37,7 @@   exposed-modules:     Network.HTTP.Client.WebSockets   build-depends:-      base >= 4.9 && < 5+      base >= 4.11 && < 5     , utf8-string     , bytestring     , network-uri >= 2.6
src/Network/HTTP/Client/WebSockets.hs view
@@ -16,7 +16,7 @@ --   >>> --   >>> import Network.HTTP.Client (Manager, newManager, defaultManagerSettings) --   >>> import qualified Network.WebSockets as WS---   >>> import Network.HTTP.Client.WebSockets as HCWS+--   >>> import qualified Network.HTTP.Client.WebSockets as HCWS --   >>> import Network.URI.Static --   >>> import Data.ByteString (ByteString) --   >>>@@ -30,12 +30,13 @@ --           echoUri = [uri|ws://echo.websocket.org|] --   :} -----   >>> -- this Manager does not support TLS, so can't use the wss scheme above+--   >>> -- this Manager does not support TLS, so we can't use the wss scheme above --   >>> newManager defaultManagerSettings >>= runEchoExample --   "hello there" module Network.HTTP.Client.WebSockets   ( runClient,     runClientWith,+    runClientWithRequest,   ) where @@ -76,6 +77,19 @@     "wss:" -> pure "https:"     s -> fail $ "invalid WebSockets scheme: " <> s   req <- HTTP.requestFromURI uri {uriScheme = httpScheme}+  runClientWithRequest mgr (req { HTTP.requestHeaders = headers }) connOpts app++runClientWithRequest ::+  -- | 'HTTP.Manager' to use to establish the connection+  HTTP.Manager ->+  -- | 'HTTP.Request' to use to open the connection, content will be ignored.+  HTTP.Request ->+  -- | Options+  WS.ConnectionOptions ->+  -- | Client application+  WS.ClientApp a ->+  IO a+runClientWithRequest mgr req connOpts app = do   HTTP.withConnection req mgr $ \conn -> do     let read = do           bs <- HTTP.connectionRead conn@@ -89,5 +103,5 @@       (UTF8.toString $ HTTP.host req)       (UTF8.toString $ HTTP.path req <> HTTP.queryString req)       connOpts-      headers+      (HTTP.requestHeaders req)       app