Closed
Description
Hi!. Currently I'm using this package to test a Hasura project, but when the WebsocketsTransport waits for the ack message on initial connection, the Hasura server first responds with a keep alive message. Because of this, the WebsocketsTransport raises a TransportProtocolError exception, given that it waits for a connection_ack
, not a ka
message.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sanchez/Projects/graphql_client.py", line 829, in test_subscription
asyncio.run(self.something())
File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/sanchez/Projects/graphql_client.py", line 839, in something
async with Client(
File "/home/sanchez/Projects/venv/lib/python3.8/site-packages/gql/client.py", line 161, in __aenter__
await self.transport.connect()
File "/home/sanchez/Projects/venv/lib/python3.8/site-packages/gql/transport/websockets.py", line 508, in connect
raise e
File "/home/sanchez/Projects/venv/lib/python3.8/site-packages/gql/transport/websockets.py", line 503, in connect
await self._send_init_message_and_wait_ack()
File "/home/sanchez/Projects/venv/lib/python3.8/site-packages/gql/transport/websockets.py", line 193, in _send_init_message_and_wait_ack
raise TransportProtocolError(
gql.transport.exceptions.TransportProtocolError: Websocket server did not return a connection ack
Here you can see the order from the messages sent by my Hasura server. In this case, I'm testing using the Hasura web console:
As you can see, the ka
message comes first, so TransportProtocolError rejects this message, and raises the above exception. Maybe TransportProtocolError needs to ignore ka
messages when wating for ack message