Skip to content

Commit e74836d

Browse files
committed
Add get_context() to prepare a context object
1 parent 09a2ffd commit e74836d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

channels_graphql_ws/graphql_ws_consumer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ async def _on_gql_start(self, op_id, payload):
540540
context.channel_name = self.channel_name
541541
context.graphql_operation_name = op_name
542542
context.graphql_operation_id = op_id
543+
context = self.get_context(context)
543544

544545
# Process the request with Graphene and GraphQL-core.
545546
doc_ast, op_ast, errors = await self._on_gql_start__parse_query(
@@ -1230,6 +1231,12 @@ def _spawn_background_task(self, awaitable):
12301231
self._background_tasks.add(background_task)
12311232
return background_task
12321233

1234+
def get_context(self, context):
1235+
"""
1236+
Prepare the context object to use during GraphQL execution.
1237+
"""
1238+
return context
1239+
12331240
@property
12341241
def _channel_layer(self):
12351242
"""Channel layer."""

0 commit comments

Comments
 (0)