base

class litestar.channels.backends.base.ChannelsBackend[源代码]

基类:ABC

abstractmethod async on_startup() None[源代码]

Called by the plugin on application startup

abstractmethod async on_shutdown() None[源代码]

Called by the plugin on application shutdown

abstractmethod async publish(data: bytes, channels: Iterable[str]) None[源代码]

Publish the message data to all channels

abstractmethod async subscribe(channels: Iterable[str]) None[源代码]

Start listening for events on channels

abstractmethod async unsubscribe(channels: Iterable[str]) None[源代码]

Stop listening for events on channels

abstractmethod stream_events() AsyncGenerator[tuple[str, bytes], None][源代码]

Return a generator, iterating over events of subscribed channels as they become available

abstractmethod async get_history(channel: str, limit: int | None = None) list[bytes][源代码]

Return the event history of channel, at most limit entries