summary refs log tree commit diff
path: root/main.py
diff options
context:
space:
mode:
authormeltland <[email protected]>2025-03-07 23:41:45 -0500
committermeltland <[email protected]>2025-03-07 23:41:45 -0500
commitd9b1580e853978f322a1bf7dee910eb1077e3d46 (patch)
treec27c64effefc3e5828f6e07bf3798d32bffb4ab0 /main.py
Initial commit
Diffstat (limited to 'main.py')
-rw-r--r--main.py23
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