summaryrefslogtreecommitdiffhomepage
path: root/Server.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-24 13:52:03 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-24 13:52:03 -0400
commit82375df3f48246e13e6c9a0c24d937a54d16359a (patch)
tree1ed19a84b3dac5c90b7d236a25b806c61566d72d /Server.hs
parenta6955dfe76856c8f2a7fb9c136dd014a8adbaea3 (diff)
downloaddebug-me-82375df3f48246e13e6c9a0c24d937a54d16359a.tar.gz
work around for https://github.com/jaspervdj/websockets/issues/140
Diffstat (limited to 'Server.hs')
-rw-r--r--Server.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/Server.hs b/Server.hs
index dc23643..5467fbe 100644
--- a/Server.hs
+++ b/Server.hs
@@ -82,7 +82,15 @@ closeSession :: Session -> STM ()
closeSession (Session bchan _ _) = closeTMChan bchan
server :: ServerOpts -> IO ()
-server o = run (serverPort o) . app o =<< newServerState
+server o = runSettings settings . app o =<< newServerState
+ where
+ settings =
+ -- Prefer IPv6 but allow IPv4 as well
+ -- (Workaround for
+ -- https://github.com/jaspervdj/websockets/issues/140)
+ setHost "*6" $
+ setPort (serverPort o) $
+ defaultSettings
app :: ServerOpts -> TVar ServerState -> Application
app o ssv = websocketsOr WS.defaultConnectionOptions (websocketApp o ssv) webapp