Build real-time features with HotWire protocol.
HotWire allows you to push updates to the client without writing complex JavaScript.
CanxJS implements a custom HotWire protocol over WebSockets.
To broadcast an event to the frontend:
import { broadcast } from "canxjs";
await broadcast("chat-room-1").emit("new-message", {
text: "Hello World",
user: "John Doe"
});On the frontend (using the canx-client library):
import { echo } from "canx-client";
echo.channel("chat-room-1")
.listen("new-message", (e) => {
console.log(e.text);
});Have questions?
Join the discussion on GitHub