jrief / django-websocket-redis

Websockets for Django applications using Redis as message queue
http://django-websocket-redis.awesto.com/
MIT License
894 stars 221 forks source link

Catch the WebSocketError when closing the connection by the client #255

Open Airboy opened 6 years ago

Airboy commented 6 years ago

Is there a way to catch the WebSocketError when the client (frontend) explicitly closes the connection? Currently, I have the following errors in my logs:

[uwsgi] WebSocketError: unable to receive websocket message
| Traceback (most recent call last):
|   File "/var/www/lib/python3.5/site-packages/ws4redis/uwsgi_runserver.py", line 28, in receive
|     return uwsgi.websocket_recv_nb()
| OSError: unable to receive websocket message
|
| During handling of the above exception, another exception occurred:
|
| Traceback (most recent call last):
|   File "/var/www/lib/python3.5/site-packages/ws4redis/wsgi_server.py", line 123, in __call__
|     recvmsg = RedisMessage(websocket.receive())
|   File "/var/www/lib/python3.5/site-packages/ws4redis/uwsgi_runserver.py", line 31, in receive
|     raise WebSocketError(e)
| ws4redis.exceptions.WebSocketError: unable to receive websocket message
| [uwsgi] WebSocketError: unable to receive websocket message
| Traceback (most recent call last):
|   File "/var/www/lib/python3.5/site-packages/ws4redis/uwsgi_runserver.py", line 28, in receive
|     return uwsgi.websocket_recv_nb()
| OSError: unable to receive websocket message

It's not critical but it should be better to catch this specific error.

ghost commented 5 years ago

have you solved this problem???