websockets-rpc 0.0.1 → 0.0.2
raw patch · 2 files changed
+4/−6 lines, 2 files
Files
src/Network/WebSockets/RPC.hs view
@@ -28,7 +28,7 @@ import Network.Wai.Trans (ServerAppT, ClientAppT) import Data.Aeson (ToJSON, FromJSON, decode, encode) -import Control.Monad (forever)+import Control.Monad (forever, void) import Control.Monad.IO.Class (liftIO, MonadIO) import Control.Monad.Catch (MonadThrow, throwM) import Control.Concurrent (threadDelay)@@ -60,7 +60,7 @@ -> ServerAppT (WebSocketServerRPCT sub sup m) rpcServer f pendingConn = do conn <- liftIO (acceptRequest pendingConn)- pingpong <- liftIO $ Async.async $ forever $ do+ void $ liftIO $ Async.async $ forever $ do sendDataMessage conn (Text (encode (Pong :: ServerToClient () ()))) threadDelay 1000000 @@ -77,7 +77,6 @@ complete com = let c = Complete RPCIdentified{_ident, _params = com} in do liftIO (sendDataMessage conn (Text (encode c)))- liftIO (Async.cancel pingpong) runWebSocketServerRPCT' env (unregisterSubscribeSupply _ident) cont :: Either sub sup -> m ()@@ -89,8 +88,7 @@ runSup :: Supply sup -> WebSocketServerRPCT sub sup m () runSup (Supply RPCIdentified{_ident,_params}) = case _params of- Nothing -> do unregisterSubscribeSupply _ident -- FIXME this could bork the server if I `async` a routine thread- liftIO (Async.cancel pingpong)+ Nothing -> unregisterSubscribeSupply _ident -- FIXME this could bork the server if I `async` a routine thread Just params -> runSubscribeSupply _ident (Right params) forever $ do
websockets-rpc.cabal view
@@ -1,5 +1,5 @@ Name: websockets-rpc-Version: 0.0.1+Version: 0.0.2 Author: Athan Clark <athan.clark@gmail.com> Maintainer: Athan Clark <athan.clark@gmail.com> License: BSD3