Metadata-Version: 2.4
Name: gqlactioncable
Version: 1.0.2
Summary: GraphQL transport for gql for the ActionCable websockets protocol
Author-email: Leszek Hanusz <leszek.hanusz@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/leszekhanusz/gql-actioncable
Project-URL: Repository, https://github.com/leszekhanusz/gql-actioncable
Keywords: api,graphql,actioncable,protocol,gql,client
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gql[websockets]>=4.0.0
Provides-Extra: dev
Requires-Dist: gql[websockets]>=4.0.0; extra == "dev"
Requires-Dist: black==25.1.0; extra == "dev"
Requires-Dist: check-manifest<1,>=0.42; extra == "dev"
Requires-Dist: flake8==7.1.2; extra == "dev"
Requires-Dist: isort==6.0.1; extra == "dev"
Requires-Dist: mypy==1.15; extra == "dev"
Dynamic: license-file

# 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)
