diff options
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/main.py b/main.py new file mode 100644 index 0000000..07eac1a --- /dev/null +++ b/main.py @@ -0,0 +1,23 @@ +import asyncio +import logging +from websockets.asyncio.server import serve + +addr = "localhost" +port = 3636 + +logging.basicConfig(level=logging.INFO) + +async def handler(websocket): + await websocket.send("Hello") + miw = 0 + async for message in websocket: + miw += 1 + async for message in websocket: + print(str(websocket)) + await websocket.send(message) + +async def main(): + async with serve(handler, addr, port) as server: + await server.serve_forever() + +asyncio.run(main()) \ No newline at end of file |