INNER CODE UNIT · Python
connect_and_init
psevensas/DjangoChannelsGraphqlWs · channels_graphql_ws/client.py:91
async def connect_and_init(self) -> None:
"""Establish and initialize WebSocket GraphQL connection.
1. Establish WebSocket connection.
2. Initialize GraphQL connection.
"""
await self._transport.connect()
await self._transport.send({"type": "connection_init", "payload": ""})
resp = await self._transport.receive()
assert resp["type"] == "connection_ack", f"Unexpected response `{resp}`!"
self._is_connected = True
# Default value for `id`, because `None` is also a valid value.
AUTO = object()
async def receive_next(self, op_id):
"""Receive GraphQL message "next" ("data" for "graphql-ws").