diff --git a/app.py b/app.py index 2b22391..a23088d 100644 --- a/app.py +++ b/app.py @@ -33,7 +33,7 @@ async def disconnect(project_id,ws): clients.get(project_id,[]).remove(ws) -async def process(ws, path): +async def handler(ws, path): project_id = "" user = "" async for msg in ws: @@ -49,10 +49,10 @@ async def process(ws, path): pass await disconnect(project_id,ws) +async def main(): + async with websockets.serve(handler, "", 9080, compression=None): + await asyncio.Future() # run forever + + if __name__ == "__main__": - try: - start_server = websockets.serve(process, 'localhost', 5000, compression=None) - finally: - pass - asyncio.get_event_loop().run_until_complete(start_server) - asyncio.get_event_loop().run_forever() \ No newline at end of file + asyncio.run(main()) \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 5590ec5..3cc17a1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,6 +3,7 @@ BASE=$(dirname $0) cd $BASE git pull +python3 -m venv env source env/bin/activate pip3 install -r requirements.txt python3 app.py \ No newline at end of file