summaryrefslogtreecommitdiffhomepage
path: root/WebSockets.hs
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 /WebSockets.hs
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
Diffstat (limited to 'WebSockets.hs')
-rw-r--r--WebSockets.hs8
1 files changed, 7 insertions, 1 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