| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
"""Echo server using the trio API.""" |
| 4 |
|
| 5 |
import trio |
| 6 |
from websockets.trio.server import serve |
| 7 |
|
| 8 |
|
| 9 |
async def echo(websocket): |
| 10 |
async for message in websocket: |
| 11 |
await websocket.send(message) |
| 12 |
|
| 13 |
|
| 14 |
if __name__ == "__main__": |
| 15 |
trio.run(serve, echo, 8765) |