No title

1
2
3
4
5
6
7
8
9
10
11
12
13
14
talk :: WS.Connection -> MVar ServerState -> Client -> IO ()
talk conn state (Client (name, _)) =
  forever $ do
    msg <- WS.receiveData conn
    serverState <- readMVar state
    print serverState
  --  print $ "our unparsed ws message from" ++ T.unpack name
  --  putStrLn $ T.unpack msg
    print $ "our parsed ws message from: " ++ T.unpack name
    print $ parseAuctionAction msg
    readMVar state >>= broadcast msg
  where
    parseAuctionAction :: Text -> Maybe AuctionAction
    parsedAuctionAction = parseAuctionAction msg