Closed synodriver closed 7 months ago
No, it's not possible given the current spec - the only way to HTTP reject a socket in the websocket part of the spec is to send websocket.close
, which will translate to a HTTP 403 error if sent before the socket is accepted.
If you want this precise a control over your websocket server you may want to investigate writing or extending your own; I've never seen anyone send trailers on websocket rejections, and I suspect we wouldn't integrate it into any ASGI spec until it became at least somewhat common.
Ok I see it. Thanks for you answer.
From the spec we know that
WebSocket Denial Response
is just regular http response, so I wonder if it's possible for an asgi app to use regular asgi http extensions in WebSocket Denial Response such ashttp.response.trailers
andhttp.response.zerocopysend
? Just like the following app.And should we change their name like
websocket.http.response.trailers
andwebsocket.http.response.zerocopysend
?