strawberry.channels.ChannelsConsumer
Base channels async consumer.
Constructor:
Signature:
def __init__(self, args: str = (), kwargs: Any = {}) -> None:  ...Parameters:
-  
args:- Type
 -  
str - Default
 -  
() 
 -  
kwargs:- Type
 -  
Any - Default
 -  
{} 
 
Methods:
-  
dispatch
Signature:
def dispatch(self, message: ChannelsMessage) -> None:...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:
def channel_listen(self,type: str,timeout: float | None = None,groups: Sequence[str] = (),) -> AsyncGenerator[Any, None]:...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_addat the beggining of the execution and then discarded usingself.channel_layer.group_discardat 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:
def listen_to_channel(self,type: str,timeout: float | None = None,groups: Sequence[str] = (),) -> AsyncGenerator[Any, None]:...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_addat the beggining of the execution and then discarded usingself.channel_layer.group_discardat 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]]