Use forkPingThread if websockets is less than 0.12.6.0

This commit is contained in:
David Burkett 2020-11-04 21:46:00 -05:00
parent da09fdc69a
commit c00d1e1aa8

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Yesod.WebSockets
@ -117,8 +118,14 @@ webSocketsOptionsWith wsConnOpts buildAr inner = do
rhead
(\pconn -> do
conn <- WS.acceptRequestWith pconn ar
WS.withPingThread conn 30 (pure ()) $
runInIO $ runReaderT inner conn)
let app = runInIO $ runReaderT inner conn
#if MIN_VERSION_websockets(0,12,6)
WS.withPingThread conn 30 (pure ()) $ app
#else
WS.forkPingThread conn 30
app
#endif
)
src
sink