Autobahn.exception.Disconnected: Попытка отправки по закрытому протоколу
У меня есть веб-сервер, загруженный на сервер, который получает сообщения от приложения Windows и отправляет их на фронт-энд в браузере
Присутствует небольшая задержка в получении и отправке, и когда я проверил журналы django, я получаю это сообщение время от времени
2022-03-03 21:04:54,257 ERROR Exception inside application: Attempt to send on a closed protocol
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/channels/routing.py", line 71, in __call__
return await application(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/channels/sessions.py", line 47, in __call__
return await self.inner(dict(scope, cookies=cookies), receive, send)
File "/usr/local/lib/python3.8/site-packages/channels/sessions.py", line 263, in __call__
return await self.inner(wrapper.scope, receive, wrapper.send)
File "/usr/local/lib/python3.8/site-packages/channels/auth.py", line 185, in __call__
return await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/channels/middleware.py", line 26, in __call__
return await self.inner(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/channels/routing.py", line 150, in __call__
return await application(
File "/usr/local/lib/python3.8/site-packages/channels/consumer.py", line 94, in app
return await consumer(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/channels/consumer.py", line 58, in __call__
await await_many_dispatch(
File "/usr/local/lib/python3.8/site-packages/channels/utils.py", line 51, in await_many_dispatch
await dispatch(result)
File "/usr/local/lib/python3.8/site-packages/channels/consumer.py", line 73, in dispatch
await handler(message)
File "/app/backend/server/./script/consumers.py", line 242, in chat_message
await self.send(text_data=json.dumps({
File "/usr/local/lib/python3.8/site-packages/channels/generic/websocket.py", line 209, in send
await super().send({"type": "websocket.send", "text": text_data})
File "/usr/local/lib/python3.8/site-packages/channels/consumer.py", line 81, in send
await self.base_send(message)
File "/usr/local/lib/python3.8/site-packages/channels/sessions.py", line 226, in send
return await self.real_send(message)
File "/usr/local/lib/python3.8/site-packages/daphne/server.py", line 234, in handle_reply
protocol.handle_reply(message)
File "/usr/local/lib/python3.8/site-packages/daphne/ws_protocol.py", line 202, in handle_reply
self.serverSend(message["text"], False)
File "/usr/local/lib/python3.8/site-packages/daphne/ws_protocol.py", line 256, in serverSend
self.sendMessage(content.encode("utf8"), binary)
File "/usr/local/lib/python3.8/site-packages/autobahn/websocket/protocol.py", line 2217, in sendMessage
raise Disconnected("Attempt to send on a closed protocol")
autobahn.exception.Disconnected: Attempt to send on a closed protocol
consumers.py
Прошло 3 дня в отладке, пока не нашли откуда эта ошибка