15 lines
340 B
Python
15 lines
340 B
Python
#!/usr/bin/env python
|
|
|
|
import asyncio
|
|
import os
|
|
|
|
import websockets
|
|
|
|
async def echo(websocket, path):
|
|
async for message in websocket:
|
|
await websocket.send(message)
|
|
|
|
start_server = websockets.serve(echo, "", int(os.environ["PORT"]))
|
|
|
|
asyncio.get_event_loop().run_until_complete(start_server)
|
|
asyncio.get_event_loop().run_forever() |