diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..1616376 --- /dev/null +++ b/Readme.md @@ -0,0 +1,22 @@ +# Jitsi Rooms + +Provides a small wrapper UI around Jitsi Meet with discord like rooms functionality. + +## Architecture + +The application consists of: + +- a plugin for the Jitsi Meet component prosody that pushes event data to a rest endpoint + - written in Lua + - location: ./prosody + - also provides a Jitsi Meet setup with docker +- a backend that accepts the events with an rest endpoint and distributes it to the clients via websockets + - written in Haskell + - location: ./backend +- a frontend that uses the Jitsi Meet iFrame Api and connects to the backend via websockets + - written in Typescript with react and vite + - location: ./frontend + +## Development + +Each subfolder contains a Readme with instructions diff --git a/backend/README.md b/backend/README.md index df37730..9c83062 100644 --- a/backend/README.md +++ b/backend/README.md @@ -1 +1,6 @@ # jitsi-rooms + +## Development + +`stack build` +`stack stack run` diff --git a/backend/src/WebServer.hs b/backend/src/WebServer.hs index 88e228f..673a55b 100644 --- a/backend/src/WebServer.hs +++ b/backend/src/WebServer.hs @@ -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