diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-24 14:04:55 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-24 14:04:55 -0400 |
commit | a6180f446dc97de56a2ed2e117c3be196d76f20b (patch) | |
tree | df67729f2450850fc419474b9504915b0a771473 /WebSockets.hs | |
parent | 82375df3f48246e13e6c9a0c24d937a54d16359a (diff) | |
download | debug-me-a6180f446dc97de56a2ed2e117c3be196d76f20b.tar.gz |
also enable compression in server
Diffstat (limited to 'WebSockets.hs')
-rw-r--r-- | WebSockets.hs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/WebSockets.hs b/WebSockets.hs index 6231298..c463c28 100644 --- a/WebSockets.hs +++ b/WebSockets.hs @@ -1,6 +1,7 @@ {-# LANGUAGE OverloadedStrings, DeriveGeneric, GeneralizedNewtypeDeriving, FlexibleContexts, FlexibleInstances #-} module WebSockets ( + connectionOptions, runClientApp, clientApp, protocolError, @@ -29,9 +30,16 @@ import qualified Data.ByteString.Lazy as L import Data.List import Data.Monoid +-- | Enable compression. +connectionOptions :: ConnectionOptions +connectionOptions = defaultConnectionOptions + { connectionCompressionOptions = + PermessageDeflateCompression defaultPermessageDeflate + } + runClientApp :: ClientApp () -> IO () runClientApp app = catchJust catchconnclosed - (runClientWith "localhost" 8081 "/" connoptions [] app) + (runClientWith "localhost" 8081 "/" connectionOptions [] app) (\_ -> return ()) where -- For some reason, runClient throws ConnectionClosed @@ -39,11 +47,6 @@ 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 |