GraphQLWSConsumer
A channels websocket consumer for GraphQL.
This handles the connections, then hands off to the appropriate handler based on the subprotocol.
To use this, place it in your ProtocolTypeRouter for your channels project, e.g:
Constructor:
Signature:
Parameters:
-
schema:
- Type
-
BaseSchema
-
keep_alive:
- Type
-
bool
- Default
-
False
-
keep_alive_interval:
- Type
-
float
- Default
-
1
-
debug:
- Type
-
bool
- Default
-
False
-
subscription_protocols:
- Type
-
Tuple[str, str]
- Default
-
(GRAPHQL_TRANSPORT_WS_PROTOCOL, GRAPHQL_WS_PROTOCOL)
-
connection_init_wait_timeout:
- Type
-
datetime.timedelta | None
- Default
-
None
Methods:
-
pick_preferred_protocol
Signature:
Parameters:
-
accepted_subprotocols:
- Type
-
Sequence[str]
-
-
connect
Signature:
-
receive
Signature:
Parameters:
-
args:
- Type
-
str
- Default
-
()
-
kwargs:
- Type
-
Any
- Default
-
{}
-
-
receive_json
Signature:
Parameters:
-
content:
- Type
-
Any
-
kwargs:
- Type
-
Any
- Default
-
{}
-
-
disconnect
Signature:
Parameters:
-
code:
- Type
-
int
-
-
get_root_value
Signature:
Parameters:
-
request:
- Type
-
ChannelsConsumer
-
-
get_context
Signature:
Parameters:
-
request:
- Type
-
ChannelsConsumer
-
connection_params:
- Type
-
Any
-
Attributes:
-
graphql_transport_ws_handler_class:
-
graphql_ws_handler_class:
-
connection_init_wait_timeout:
-
schema:
-
keep_alive:
-
keep_alive_interval:
-
debug:
-
protocols: