You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to add permessage_deflate Websocket extension support for django_channels consumer/server. Server has to provide supported extensions in the headers of handshake response, e.g. Sec-Websocket-Extensions: permessage-deflate. ASGIREF documentation states, that "headers" section is supported for "websocket.accept" message type. Hence, I have tried to accept Websocket connection with this code:
from channels.generic.websocket import AsyncJsonWebsocketConsumer
class CeleryTaskConsumer(AsyncJsonWebsocketConsumer):
async def connect(self):
await self.base_send({
"type": "websocket.accept",
"headers": [
(b"sec-websocket-extensions", b"permessage-deflate")
]
})
The text was updated successfully, but these errors were encountered:
albertas
changed the title
Daphne ignores headers section from "websocket.accept" message
Daphne ignores "headers" section from "websocket.accept" message
Jul 29, 2020
Sure, I will try adding "headers" section support myself. However, I don't know what are other changes in 2.1 websocket spec, hence they will be out of my PR scope.
I want to add
permessage_deflate
Websocket extension support fordjango_channels
consumer/server. Server has to provide supported extensions in the headers of handshake response, e.g.Sec-Websocket-Extensions: permessage-deflate
. ASGIREF documentation states, that"headers"
section is supported for"websocket.accept"
message type. Hence, I have tried to accept Websocket connection with this code:However, the daphne server ignores the
"headers"
section of this message and only uses"subprotocol"
section:https://github.com/django/daphne/blob/master/daphne/ws_protocol.py#L185
That means, that Daphne server has no way to inform client, that it supports some kind of Websocket extensions, which is a major limitation.
pip freeze:
The text was updated successfully, but these errors were encountered: