Skip to content

Commit a508a20

Browse files
committed
Minor changes to get app to initialize with no errors with client
1 parent bbe82f7 commit a508a20

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

subscriptions/subscription_transport_ws.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,18 @@ def unsubscribe(self, graphql_sub_id):
3131
self.subscription_manager.unsubscribe(graphql_sub_id)
3232

3333
def on_open(self):
34-
if self.ws.protocol is None or GRAPHQL_SUBSCRIPTIONS not in self.ws.protocol:
34+
if self.ws.protocol is None or (GRAPHQL_SUBSCRIPTIONS not in self.ws.protocol):
3535
self.ws.close(1002)
3636

37-
def on_close(self):
37+
def on_close(self, reason):
3838
for sub_id in self.connection_subscriptions.keys():
3939
self.unsubscribe(self.connection_subscriptions[sub_id])
4040
del self.connection_subscriptions[sub_id]
4141

42-
def on_message(self, message):
42+
def on_message(self, msg):
43+
if msg is None:
44+
return
45+
4346
class nonlocal:
4447
on_init_resolve = None
4548
on_init_reject = None
@@ -50,7 +53,7 @@ def init_promise_handler(resolve, reject):
5053

5154
self.connection_context['init_promise'] = Promise(init_promise_handler)
5255

53-
def on_message_return_handler(msg):
56+
def on_message_return_handler(message):
5457
try:
5558
parsed_message = json.loads(message)
5659
except Exception as e:
@@ -187,7 +190,7 @@ def subscription_end_promise_handler(result):
187190
}]
188191
})
189192

190-
return on_message_return_handler()
193+
return on_message_return_handler(msg)
191194

192195
def send_subscription_data(self, sub_id, payload):
193196
message = {

0 commit comments

Comments
 (0)