websockets-simple 0.0.6.1 → 0.0.6.2
raw patch · 2 files changed
+19/−12 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- src/Test/WebSockets/Simple.hs +18/−11
- websockets-simple.cabal +1/−1
src/Test/WebSockets/Simple.hs view
@@ -12,9 +12,10 @@ import Control.Monad (forever, void) import Control.Monad.IO.Class (MonadIO (..)) import Control.Monad.Trans.Control (MonadBaseControl (..))+import Control.Concurrent (threadDelay) import Control.Concurrent.Async (Async, async) import Control.Concurrent.STM (atomically)-import Control.Concurrent.STM.TChan (TChan, newTChan, writeTChan, readTChan)+import Control.Concurrent.STM.TChan (TChan, newTChan, writeTChan, readTChan, tryReadTChan) @@ -41,18 +42,24 @@ onClose sendsSreceivesR Nothing sToR <- liftBaseWith $ \runInBase -> async $ forever $ do- s <- atomically $ readTChan sendChan- void $ runInBase $ onReceive sendsRreceivesS WebSocketsAppParams- { send = sendToReceive- , close- } s+ mS <- atomically $ tryReadTChan sendChan+ case mS of+ Nothing -> threadDelay 100+ Just s ->+ void $ runInBase $ onReceive sendsRreceivesS WebSocketsAppParams+ { send = sendToReceive+ , close+ } s rToS <- liftBaseWith $ \runInBase -> async $ forever $ do- r <- atomically $ readTChan receiveChan- void $ runInBase $ onReceive sendsSreceivesR WebSocketsAppParams- { send = sendToSend- , close- } r+ mR <- atomically $ tryReadTChan receiveChan+ case mR of+ Nothing -> threadDelay 100+ Just r ->+ void $ runInBase $ onReceive sendsSreceivesR WebSocketsAppParams+ { send = sendToSend+ , close+ } r onOpen sendsRreceivesS WebSocketsAppParams { send = sendToReceive
websockets-simple.cabal view
@@ -1,5 +1,5 @@ name: websockets-simple-version: 0.0.6.1+version: 0.0.6.2 synopsis: Simpler interface to the websockets api -- description: homepage: https://github.com/athanclark/websockets-simple#readme