Skip to main content

GraphQL transport for gql for the ActionCable websockets protocol

Project description

gql-actioncable

This is a graphql-python/gql transport for the ActionCable websockets protocol.

Installation

You can install the transport with:

pip install gqlactioncable

Usage

Here is an example using the sorare.com GraphQL websockets backend:

import asyncio

from gql import Client, gql

from gqlactioncable import ActionCableWebsocketsTransport


async def main():

    transport = ActionCableWebsocketsTransport(
        url="wss://ws.sorare.com/cable",
        keep_alive_timeout=60,
    )

    async with Client(transport=transport) as session:

        subscription = gql(
            """
            subscription onAnyCardUpdated {
              anyCardWasUpdated {
                card {
                  name
                  grade
                }
              }
            }
        """
        )

        async for result in session.subscribe(subscription):
            print(result["anyCardWasUpdated"])


asyncio.run(main())

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gqlactioncable-1.0.2.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gqlactioncable-1.0.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file gqlactioncable-1.0.2.tar.gz.

File metadata

  • Download URL: gqlactioncable-1.0.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gqlactioncable-1.0.2.tar.gz
Algorithm Hash digest
SHA256 c2517ecb259c492183089bcbe13527cf2d9c53885486df27e309da102804ece7
MD5 e64076a584261cc42fc8a62284501b07
BLAKE2b-256 b4556753ab30f9c512596cc90d2aa18636b681f4b748fa4418f4432ea1b9eb57

See more details on using hashes here.

File details

Details for the file gqlactioncable-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: gqlactioncable-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gqlactioncable-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0137aadbf4da8ccfd3ecf98f2b2f617419615363d19496049af6917a8be18f2a
MD5 83d02cb09e7e1502bf04009edd2438f5
BLAKE2b-256 40f2a763fb849f6c39ad9f35130b0751f13a3a24aa2969e038d77f48bd29e5f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page