Skip to content

Commit

Permalink
Add allow_subscriptions to the TornadoGraphQLHandler (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
kinow authored and ewhauser committed Sep 4, 2019
1 parent 82aaee7 commit b0e4b75
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions graphene_tornado/tornado_graphql_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class TornadoGraphQLHandler(web.RequestHandler):
extension_stack = GraphQLExtensionStack()

def initialize(self, schema=None, executor=None, middleware=None, root_value=None, graphiql=False, pretty=False,
batch=False, backend=None, extensions=None):
batch=False, backend=None, extensions=None, allow_subscriptions=False):
super(TornadoGraphQLHandler, self).initialize()

self.schema = schema
Expand All @@ -75,6 +75,7 @@ def initialize(self, schema=None, executor=None, middleware=None, root_value=Non
self.graphiql = graphiql
self.batch = batch
self.backend = backend or get_default_backend()
self.allow_subscriptions = allow_subscriptions

@property
def context(self):
Expand Down Expand Up @@ -295,7 +296,8 @@ def execute_graphql_request(self, method, query, variables, operation_name, show
context=self.context,
middleware=self.get_middleware(),
executor=self.executor or TornadoExecutor(),
return_promise=True
return_promise=True,
allow_subscriptions=self.allow_subscriptions
)
yield execution_ended()
except Exception as e:
Expand Down

0 comments on commit b0e4b75

Please sign in to comment.