Ramesh-vani commited on
Commit
1b93421
1 Parent(s): 373030d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import websockets
3
+
4
+ async def echo(websocket, path):
5
+ async for message in websocket:
6
+ await websocket.send(message)
7
+
8
+ async def main():
9
+ async with websockets.serve(echo, "localhost", 8765):
10
+ await asyncio.Future() # Keeps the server running indefinitely
11
+
12
+ asyncio.run(main())