summaryrefslogtreecommitdiffhomepage
path: root/WebSockets.hs
diff options
context:
space:
mode:
Diffstat (limited to 'WebSockets.hs')
-rw-r--r--WebSockets.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/WebSockets.hs b/WebSockets.hs
index a220c68..359fe7b 100644
--- a/WebSockets.hs
+++ b/WebSockets.hs
@@ -5,6 +5,7 @@
{-# LANGUAGE OverloadedStrings, DeriveGeneric, GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleContexts, FlexibleInstances, ScopedTypeVariables #-}
+{-# LANGUAGE CPP #-}
module WebSockets (
connectionOptions,
@@ -91,7 +92,9 @@ instance WebSocketsData WireProtocol where
WireProtocolError
(Data.Aeson.decode s)
_ -> WireProtocolError "received unknown websocket message"
+#if MIN_VERSION_websockets(0,10,0)
fromDataMessage = fromLazyByteString . fromDataMessage
+#endif
-- | Modes of operation that can be requested for a websocket connection.
data Mode
@@ -113,12 +116,14 @@ instance ToJSON WireVersion
supportedWireVersions :: [WireVersion]
supportedWireVersions = [WireVersion "1"]
--- | Enable compression.
connectionOptions :: ConnectionOptions
connectionOptions = defaultConnectionOptions
+#if MIN_VERSION_websockets(0,10,0)
+ -- Enable compression.
{ connectionCompressionOptions =
PermessageDeflateCompression defaultPermessageDeflate
}
+#endif
-- For some reason, runClient throws ConnectionClosed
-- when the server hangs up cleanly. Catch this unwanted exception.