summaryrefslogtreecommitdiffhomepage
path: root/WebSockets.hs
diff options
context:
space:
mode:
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