Skip to content

Commit 484c160

Browse files
authored
Add readme for room manager (#16)
* Add readme for room manager * Update pyright * Fix imports in example * Requested changes
1 parent 85c2b5e commit 484c160

File tree

10 files changed

+53
-9
lines changed

10 files changed

+53
-9
lines changed

examples/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Fishjam Room Manager
2+
3+
## Running (in dev mode)
4+
All available options are defined in [arguments.py](room_manager/arguments.py).
5+
6+
```console
7+
poetry install
8+
poetry run room_manager # Room Manager has to be started in the project root directory
9+
```
10+
11+
## How does it work?
12+
13+
Fishjam Room Manager serves the purpose of a simple backend that allows users to create and/or join Fishjam rooms.
14+
Users must provide a room name and their username to obtain an authentication token that allows them to connect to a Fishjam instance.
15+
Room Manager manages the room names and user names by itself by keeping the mappings in memory.
16+
17+
As of now, it exposes 2 endpoints.
18+
19+
### '/api/rooms/:roomName/users/:username'
20+
21+
Returns authentication token for a username in a given room. If the user doesn't exist yet, it will be created.
22+
23+
### '/api/rooms/webhook'
24+
25+
Exposes a webhook endpoint to allow the Fishjam instance to send notifications to the Room Manager.
File renamed without changes.

examples/room-manager/arguments.py renamed to examples/room_manager/arguments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
def parse_arguments():
55
parser = argparse.ArgumentParser(description="Room Manager")
66

7-
parser.add_argument("--port", type=int, default=5002)
7+
parser.add_argument("--port", type=int, default=5000)
88
parser.add_argument("--peerless_purge_timeout", type=int, default=None)
99
parser.add_argument("--webhook_url", type=str, default=None)
1010
parser.add_argument("--enable_simulcast", type=str, default=True)

examples/room-manager/main.py renamed to examples/room_manager/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
setup_routes(app, room_service)
1919

20-
app.run()
20+
app.run(port=args.port)
File renamed without changes.
File renamed without changes.

poetry.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

poetry.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[virtualenvs]
2+
in-project = true
3+
create = true

poetry_scripts.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import shutil
23
import subprocess
34
import sys
@@ -57,8 +58,8 @@ def generate_docs():
5758
check_exit_code(
5859
"pdoc \
5960
--include-undocumented \
60-
--favicon https://logo.swmansion.com/membrane/\?width\=100\&variant\=signetDark\
61-
--logo https://logo.swmansion.com/membrane/\?width\=70\&variant\=signetDark\
61+
--favicon https://logo.swmansion.com/membrane/\\?width\\=100\\&variant\\=signetDark\
62+
--logo https://logo.swmansion.com/membrane/\\?width\\=70\\&variant\\=signetDark\
6263
-t templates/doc \
6364
-o doc \
6465
fishjam"
@@ -90,3 +91,17 @@ def update_client():
9091
--config openapi-python-client-config.yaml \
9192
--custom-template-path=templates/openapi"
9293
)
94+
95+
96+
def start_room_manager():
97+
current_path = os.getcwd()
98+
current_folder = os.path.basename(current_path)
99+
100+
if current_folder != "python-server-sdk":
101+
raise RuntimeError(
102+
"Room Manager has to be started from the `python-server-sdk` directory."
103+
)
104+
105+
subprocess.run(
106+
["python", "-m", "examples.room_manager.main"] + sys.argv[1:], check=False
107+
)

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ lint = "poetry_scripts:run_linter"
4848
fix_lint = "poetry_scripts:run_linter_fix"
4949
generate_docs = "poetry_scripts:generate_docs"
5050
update_client = "poetry_scripts:update_client"
51+
room_manager = "poetry_scripts:start_room_manager"
5152

5253
[tool.ruff]
5354
select = ["F", "I"]
@@ -65,7 +66,7 @@ markers = [
6566
]
6667

6768
[tool.pyright]
68-
exclude = ["**/venv", "**/__pycache__", ".pytest_cache", ".ruff_cache", "lib", "fishjam/_openapi_client", "tests"]
69+
exclude = ["**/.venv", "**/__pycache__", ".pytest_cache", ".ruff_cache", "lib", "fishjam/_openapi_client", "tests"]
6970
typeCheckingMode = "basic"
70-
venv = "venv"
71+
venv = ".venv"
7172
venvPath = "."

0 commit comments

Comments
 (0)