Skip to content

Commit

Permalink
Merge branch 'middleware-for-django'
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileyChris committed Dec 16, 2021
2 parents dc86b24 + 625e82b commit 36da445
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion graphql_ws/django/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class ChannelsConnectionContext(BaseAsyncConnectionContext):
def __init__(self, *args, **kwargs):
super(ChannelsConnectionContext, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.socket_closed = False

async def send(self, data):
Expand Down Expand Up @@ -35,5 +35,11 @@ async def handle(self, ws, request_context=None):
await self.on_open(connection_context)
return connection_context

def get_graphql_params(self, connection_context, payload):
params = super().get_graphql_params(connection_context, payload)
if graphene_settings.MIDDLEWARE:
params["middleware"] = graphene_settings.MIDDLEWARE
return params


subscription_server = ChannelsSubscriptionServer(schema=graphene_settings.SCHEMA)

0 comments on commit 36da445

Please sign in to comment.