semvec/pypi-packages huggingface dataset:
gqlactioncable 1.0.2
GraphQL transport for gql for the ActionCable websockets protocol
Requires Python: >=3.9
Keywords: api, graphql, actioncable, protocol, gql, client

# gql-actioncable

This is a [graphql-python/gql](https://github.com/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:

```python
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](https://github.com/graphql-python/gql/blob/master/LICENSE)