ChanX Kit¶
Pronounced "chan-X kit": a collection of composable, copy-in WebSocket kits for chanx (CHANnels-eXtension).
Instead of installing a framework that owns your consumers, you copy a kit into your project and own it. No hidden abstractions, no dependency you cannot inspect, and an install footprint that is exactly what you used.
-
Copy, don't install
copit add @chanx-kit/notificationdrops readable source into your project. Edit it, delete half of it, rename things. It's yours. -
Typed end to end
pyright strict with no suppressions, and TypeScript types generated from the server's own AsyncAPI schema.
-
Django and FastAPI
Kits import only
chanx.core, so one component runs on Channels and fast-channels. Every kit's tests run on both in CI. -
Composable
Stack as many kits into one consumer as you like, with no type errors and no
# pyright: ignore.
In one minute¶
from chanx.fast_channels.websocket import AsyncJsonWebsocketConsumer
from .ws_kits.notification import NotificationMessage, UserNotificationTopic
class AppConsumer(AsyncJsonWebsocketConsumer[NotificationMessage]):
channel_layer_alias = "default"
topics = [UserNotificationTopic]
Then, from a signal, a worker, or another service, with the consumer never imported: