handlePing :: (MonadIO m, Monad m)
           => Pipe Message Command m r
handlePing = do
  msg <- await
  case msgCommand msg of
    PingCmd a b -> yield (PongCmd a b) >> liftIO (putStrLn "Ping handled") >> handlePing
    _ -> handlePing

-- | Proxy that sends command to the socket
handlePing :: (MonadIO m, Monad m)
           => Pipe Message Command m r
handlePing = do
  msg <- await
  case msgCommand msg of
    PingCmd a b -> yield (PongCmd a b) >> liftIO (putStrLn "Ping handled") >> handlePing
    _ -> handlePing

-- | Proxy that sends command to the socket
handlePing = do
  msg <- await
  case msgCommand msg of
    PingCmd a b -> yield (PongCmd a b) >> liftIO (putStrLn "Ping handled") >> handlePing
    _ -> handlePing

-- | Proxy that sends command to the socket