Files
Miguel Grinberg 20ea305fe7 v2 (#186)
2023-12-22 20:26:07 +00:00

21 lines
341 B
Python

from microdot import Microdot, send_file
from microdot.websocket import with_websocket
app = Microdot()
@app.route('/')
async def index(request):
return send_file('index.html')
@app.route('/echo')
@with_websocket
async def echo(request, ws):
while True:
data = await ws.receive()
await ws.send(data)
app.run()