AI-Colab / app_echo.py
A.Tuin
Out_2026_04_08
61898fa
Raw History Blame Contribute Delete
719 Bytes
from quart import Quart, websocket
import json
import sys
app = Quart(__name__)
@app.websocket('/ws/echo')
async def echo():
print("WS: Connection request...")
await websocket.accept()
print("WS: Connection accepted")
try:
while True:
data = await websocket.receive()
print(f"WS: Received: {data}")
await websocket.send(f"echo: {data}")
except Exception as e:
print(f"WS: Connection closed/error: {e}")
if __name__ == '__main__':
print("Starting Echo Server on port 5005...")
# Принудительно отключаем дебаг для чистоты эксперимента
app.run(host='127.0.0.1', port=5005, debug=False)