|
|
|
@ -21,19 +21,12 @@ async def websocket_handler(request): |
|
|
|
|
await ws.prepare(request) |
|
|
|
|
asyncio.create_task(secondary_functions.time_response(ws, delay=60)) |
|
|
|
|
async for msg in ws: |
|
|
|
|
|
|
|
|
|
if msg.type == aiohttp.WSMsgType.TEXT: |
|
|
|
|
|
|
|
|
|
if msg.data == 'close': |
|
|
|
|
await ws.close() |
|
|
|
|
else: |
|
|
|
|
await ws.send_str(f'Вы ввели: {msg.data}') |
|
|
|
|
await ws.send_str(f'Вы ввели: {msg.data}') |
|
|
|
|
elif msg.type == WSMsgType.ERROR: |
|
|
|
|
print('ws connection closed with exception %s' % |
|
|
|
|
ws.exception()) |
|
|
|
|
|
|
|
|
|
print('websocket connection closed') |
|
|
|
|
|
|
|
|
|
return ws |
|
|
|
|
|
|
|
|
|
|
|
|
|
|