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",
    )

    async with Client(transport=transport) as session:

        subscription = gql(
            """
            subscription onAnyCardUpdated {
              aCardWasUpdated {
                slug
              }
            }
        """
        )

        async for result in session.subscribe(subscription):
            print(result)


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-0.0.2.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

gqlactioncable-0.0.2-py2.py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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