Debian Codegraph @

docs/examples/channels/create_route_handlers_send_history.py

raw
1 from litestar import Litestar
2 from litestar.channels import ChannelsPlugin
3 from litestar.channels.backends.memory import MemoryChannelsBackend
4
5 channels_plugin = ChannelsPlugin(
6 backend=MemoryChannelsBackend(history=10), # set the amount of messages per channel
7 # to keep in the backend
8 channels=["foo", "bar"],
9 create_ws_route_handlers=True,
10 ws_handler_send_history=10, # send 10 entries of the history by default
11 )
12
13 app = Litestar(plugins=[channels_plugin])