diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..bcf6804 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: python main.py \ No newline at end of file diff --git a/main.py b/main.py index 188c6d7..e26f08e 100644 --- a/main.py +++ b/main.py @@ -1,13 +1,15 @@ #!/usr/bin/env python import asyncio +import os + import websockets async def echo(websocket, path): async for message in websocket: await websocket.send(message) -asyncio.get_event_loop().run_until_complete( - websockets.serve(echo, "", 5000)) -print("starting websocket...") +start_server = websockets.serve(echo, "", int(os.environ["PORT"])) + +asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever() \ No newline at end of file