summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-24 12:10:10 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-24 13:46:44 -0400
commita6955dfe76856c8f2a7fb9c136dd014a8adbaea3 (patch)
tree2c103e662866b92aa95bb8f9dd5c727df8e37eea
parentaf3a7d1a5fdbc5e0e082f55d17d65c03691749c6 (diff)
downloaddebug-me-a6955dfe76856c8f2a7fb9c136dd014a8adbaea3.tar.gz
websockets-0.11.0.0 including enabling compression
Does not currently work, see https://github.com/jaspervdj/websockets/issues/140
-rw-r--r--WebSockets.hs8
-rw-r--r--debug-me.cabal2
-rw-r--r--stack.yaml1
3 files changed, 9 insertions, 2 deletions
diff --git a/WebSockets.hs b/WebSockets.hs
index 395a707..6231298 100644
--- a/WebSockets.hs
+++ b/WebSockets.hs
@@ -31,7 +31,7 @@ import Data.Monoid
runClientApp :: ClientApp () -> IO ()
runClientApp app = catchJust catchconnclosed
- (runClient "localhost" 8081 "/" app)
+ (runClientWith "localhost" 8081 "/" connoptions [] app)
(\_ -> return ())
where
-- For some reason, runClient throws ConnectionClosed
@@ -39,6 +39,11 @@ runClientApp app = catchJust catchconnclosed
catchconnclosed ConnectionClosed = Just ()
catchconnclosed _ = Nothing
+ connoptions = defaultConnectionOptions
+ { connectionCompressionOptions =
+ PermessageDeflateCompression defaultPermessageDeflate
+ }
+
-- | Make a client that sends and receives LogMessages over a websocket.
clientApp
:: Mode
@@ -138,6 +143,7 @@ instance WebSocketsData WireProtocol where
WireProtocolError
(Data.Aeson.decode s)
_ -> WireProtocolError "received unknown websocket message"
+ fromDataMessage = fromLazyByteString . fromDataMessage
protocolError :: Connection -> String -> IO a
protocolError conn err = do
diff --git a/debug-me.cabal b/debug-me.cabal
index cbec817..8db9d4d 100644
--- a/debug-me.cabal
+++ b/debug-me.cabal
@@ -48,7 +48,7 @@ Executable debug-me
, warp (>= 3.2)
, wai (>= 3.2)
, http-types (>= 0.9)
- , websockets (>= 0.10)
+ , websockets (>= 0.11.1)
, wai-websockets (>= 3.0)
, uuid (>= 1.3)
Other-Modules:
diff --git a/stack.yaml b/stack.yaml
index 2de8cca..784d3fe 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -3,4 +3,5 @@ packages:
resolver: lts-8.12
extra-deps:
- posix-pty-0.2.1
+- websockets-0.11.1.0
explicit-setup-deps: