Skip to content

Commit 36da445

Browse files
committed
Merge branch 'middleware-for-django'
2 parents dc86b24 + 625e82b commit 36da445

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

graphql_ws/django/subscriptions.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class ChannelsConnectionContext(BaseAsyncConnectionContext):
99
def __init__(self, *args, **kwargs):
10-
super(ChannelsConnectionContext, self).__init__(*args, **kwargs)
10+
super().__init__(*args, **kwargs)
1111
self.socket_closed = False
1212

1313
async def send(self, data):
@@ -35,5 +35,11 @@ async def handle(self, ws, request_context=None):
3535
await self.on_open(connection_context)
3636
return connection_context
3737

38+
def get_graphql_params(self, connection_context, payload):
39+
params = super().get_graphql_params(connection_context, payload)
40+
if graphene_settings.MIDDLEWARE:
41+
params["middleware"] = graphene_settings.MIDDLEWARE
42+
return params
43+
3844

3945
subscription_server = ChannelsSubscriptionServer(schema=graphene_settings.SCHEMA)

0 commit comments

Comments
 (0)