INNER CODE UNIT · Python

_is_ping_pong_message

psevensas/DjangoChannelsGraphqlWs · channels_graphql_ws/client.py:303

    def _is_ping_pong_message(self, response):
        """Check if GQL response is "ping" or "pong" ("keepalive" for
        "graphql-ws" subprotocol)."""
        msg_type = response.get("type")
        return (
            msg_type in ("ping", "pong")
            and self._subprotocol == "graphql-transport-ws"
            or msg_type == "ka"
            and self._subprotocol == "graphql-ws"
        )


class GraphqlWsResponseError(Exception):
    """Errors data from the GraphQL response."""

    def __init__(self, response, message=None):
        """Exception constructor."""
        super().__init__(self)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…