Main readme

This commit is contained in:
qvalentin 2023-01-22 13:05:50 +01:00
parent ac93ae02e0
commit cdfc0849cf
3 changed files with 34 additions and 6 deletions

View file

@ -1 +1,6 @@
# jitsi-rooms
## Development
`stack build`
`stack stack run`

View file

@ -6,19 +6,20 @@ import Network.Wai
import Network.Wai.Handler.Warp (run)
import WebSocket (ServerState, broadcast)
-- todo: use ReaderT instead of curring the state
-- then add a MVar for storing the room Data, including users that are not in any room yet
app :: MVar ServerState -> Application
app state _ respond = do
app state req respond = do
putStrLn "I've done some IO here"
currentState <- takeMVar state
broadcast "dsa" currentState
putMVar state currentState
withMVar state $ \currenState -> broadcast "body of req" currenState
respond $
responseLBS
status200
[("Content-Type", "text/plain")]
"Hello, Web!"
""
runWebServer :: MVar ServerState -> IO ()
runWebServer state = do
putStrLn $ "http://localhost:8080/"
putStrLn "http://localhost:8080/"
run 8080 $ app state