Websocket server for GraphQL subscriptions
Project description
A GraphQL WebSocket server and client to facilitate GraphQL queries, mutations and subscriptions over WebSocket (for Python 3.6+). This code is based on the current implementation of subscriptions-transport-ws.
Getting Started
Start by installing the package using pip:
Or, by using your favorite package manager, like Poetry:
With aiohttp
Usage with aiohttp is simple:
For other frameworks
Adding support for other web frameworks is simple. A framework must provide a concrete implementation of graphql_ws.abc.AbstractConnectionContext, and then it’s ready to use with the SubscriptionServer.
Usage
Using apollo-link-ws you can opt to use websockets for queries and mutations in addition to subscriptions.
Use it with GraphiQL
Look in the demo<./demo>_ directory to see usage examples for GraphiQL. Due to the implementation of the javascript client for GraphiQL (GraphiQL-Subscriptions-Fetcher), queries and mutations will not be handled over websocket.
Contributing
This project uses Poetry, so to contribute, simply fork and clone this repository, and then set up your virtual environment using:
If you don’t yet have Poetry installed, please follow the documentation for installation.
Code formatting is done via black, and code should be well-typed using mypy.
License
This package is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file graphql-ws-next-1.0.0.tar.gz
.
File metadata
- Download URL: graphql-ws-next-1.0.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.11.5 CPython/3.7.0 Darwin/17.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 423ce220833b55fc571d3a8c3b733c908672aecaba2546703eb24acd61dcfeb7 |
|
MD5 | d473e25d208b2baf5f548d894efc906b |
|
BLAKE2b-256 | 9b0890ba55f8ccdcc877f3ea5fcae10007955db64daa82bf4db915f346c52a4b |
File details
Details for the file graphql_ws_next-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: graphql_ws_next-1.0.0-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.11.5 CPython/3.7.0 Darwin/17.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d76a019ea64730af77f3a0ff3e15de62502b132a4ae3a02628fca3725f2bf907 |
|
MD5 | e66c40dab5feccac94787dc689635ca0 |
|
BLAKE2b-256 | 621d3323cf6f7acab2a74d3adaf28c4f3b8ba360560af0591341b4fa626f252e |