ChannelsConsumer
Base channels async consumer.
Constructor:
Signature:
Parameters:
-
args:
- Type
-
str
- Default
-
()
-
kwargs:
- Type
-
Any
- Default
-
{}
Methods:
-
dispatch
Signature:
Parameters:
-
message:
- Type
-
ChannelsMessage
-
-
channel_listen
Listen for messages sent to this consumer.
Utility to listen for channels messages for this consumer inside a resolver (usually inside a subscription).
Signature:
Parameters:
-
type:
The type of the message to wait for.
- Type
-
str
-
timeout:
An optional timeout to wait for each subsequent message
- Type
-
float | None
- Default
-
None
-
groups:
An optional sequence of groups to receive messages from. When passing this parameter, the groups will be registered using
self.channel_layer.group_add
at the beggining of the execution and then discarded usingself.channel_layer.group_discard
at the end of the execution.- Type
-
Sequence[str]
- Default
-
()
-
-
listen_to_channel
Listen for messages sent to this consumer.
Utility to listen for channels messages for this consumer inside a resolver (usually inside a subscription).
Signature:
Parameters:
-
type:
The type of the message to wait for.
- Type
-
str
-
timeout:
An optional timeout to wait for each subsequent message
- Type
-
float | None
- Default
-
None
-
groups:
An optional sequence of groups to receive messages from. When passing this parameter, the groups will be registered using
self.channel_layer.group_add
at the beggining of the execution and then discarded usingself.channel_layer.group_discard
at the end of the execution.- Type
-
Sequence[str]
- Default
-
()
-
Attributes:
-
channel_name:
- Type
-
str
-
channel_layer:
- Type
-
ChannelsLayer | None
-
channel_receive:
- Type
-
Callable[[], Awaitable[dict]]
-
listen_queues:
- Type
-
DefaultDict[str, WeakSet[asyncio.Queue]]