summaryrefslogtreecommitdiffhomepage
path: root/WebSockets.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-05-02 22:45:58 -0400
committerJoey Hess <joeyh@joeyh.name>2017-05-02 22:45:58 -0400
commitee4f328031c8072868854ebcd5a1e5b628a226ae (patch)
treedfcd14d0433c1aba608aa8e5cacd0791965267aa /WebSockets.hs
parent3b7b248eaada1bbf71f467c37a5da1196e1bba83 (diff)
downloaddebug-me-ee4f328031c8072868854ebcd5a1e5b628a226ae.tar.gz
allow building with versions in debian
When built with old websockets, compression is not supported. Client and server will negotiate that so version skew between them is not a problem.
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.