From a6955dfe76856c8f2a7fb9c136dd014a8adbaea3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 24 Apr 2017 12:10:10 -0400 Subject: websockets-0.11.0.0 including enabling compression Does not currently work, see https://github.com/jaspervdj/websockets/issues/140 --- WebSockets.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'WebSockets.hs') 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 -- cgit v1.2.3