django / daphne

Django Channels HTTP/WebSocket server
BSD 3-Clause "New" or "Revised" License
2.37k stars 266 forks source link

Websocket Close reason #374

Open asgoel opened 3 years ago

asgoel commented 3 years ago

Are there plans to add support for the close reason as well as the close code for websockets? Have a use case for it, and was just curious.

carltongibson commented 3 years ago

This would be a topic to raise as a change to the ASGI spec here no?

https://asgi.readthedocs.io/en/latest/specs/www.html#close-send-event

asgoel commented 3 years ago

I'm not sure? It looks like uvicorn does support it: https://github.com/encode/uvicorn/blob/c87c7834b77583efd5963dfddb08681206701d33/uvicorn/protocols/websockets/websockets_impl.py#L266-L270

soerenbe commented 4 months ago

I ran into the same issue. This is implemented in the autobahn library and not in daphne. I have created an issue there. See https://github.com/crossbario/autobahn-python/issues/1642