update handler

This commit is contained in:
arne 2023-01-31 20:35:27 +01:00
parent 02142ffb2b
commit 249a85539d
2 changed files with 8 additions and 7 deletions

14
app.py
View File

@ -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()
asyncio.run(main())

View File

@ -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