Centrifugo real-time for Tauri 2 apps
Connect, subscribe, publish, RPC, history and presence from your Tauri frontend or backend, on desktop, Android and iOS.
What you get
Connect, listen, publish
Connect once, listen to centrifugo:* events and publish JSON. Reconnects, token refresh and recovery are handled by the SDK.
main.ts
import { connect, onConnected, onMessage, helpers } from "tauri-plugin-centrifugo-api";
await onConnected(({ payload }) => console.log("connected, client", payload.client));
await onMessage(({ channel, data }) => console.log(channel, data)); // parsed JSON
await connect({
url: "ws://localhost:8000/connection/websocket",
channels: ["news"],
useProtobuf: false,
});
await helpers.waitForConnection();
await helpers.publishJson("news", { text: "hello" });