Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

echo-server.py 486B

1 year ago
123456789101112131415161718192021
  1. #!/usr/bin/env python
  2. # From https://github.com/aaugustin/websockets/blob/main/example/echo.py
  3. import asyncio
  4. import websockets
  5. import os
  6. LOCAL_WS_SERVER_PORT = int(os.environ.get('LOCAL_WS_SERVER_PORT', '8765'))
  7. async def echo(websocket, path):
  8. async for message in websocket:
  9. await websocket.send(message)
  10. async def main():
  11. async with websockets.serve(echo, "localhost", LOCAL_WS_SERVER_PORT):
  12. await asyncio.Future() # run forever
  13. asyncio.run(main())