@@ -13,7 +13,7 @@ nearby to check out the functions we use.
1313> import Data.Text (Text)
1414> import Control.Exception (fromException, handle)
1515> import Control.Monad (forM_, forever)
16−> import Control.Concurrent (MVar, newMVar, modifyMVar_, readMVar)
16+> import Control.Concurrent (MVar, newMVar, modifyMVar_, readMVar, forkIO)
1717> import Control.Monad.IO.Class (liftIO)
1818> import qualified Data.Text as T
1919> import qualified Data.Text.IO as T
@@ -66,7 +66,7 @@ Send a message to all clients, and log it on stdout.
6666> broadcast :: Text -> ServerState -> IO ()
6767> broadcast message clients = do
6868> T.putStrLn message
69−> forM_ clients $ \(_, conn) -> WS.sendTextData conn message
69+> forM_ clients $ \(_, conn) -> forkIO $ WS.sendTextData conn message
7070
7171The main function first creates a new state for the server, then spawns the
7272actual server. For this purpose, we use the simple server provided by