Quickstart
Five minutes from nothing to a message arriving in a browser.
1. Create an app
Sign up, verify your email, then create an app in the dashboard. Its Overview page shows your app_id, key and secret, and the address clients connect to. On this deployment that is ws.push.vixus.io:443.
2. Install the libraries
Any Pusher library works. For JavaScript:
bash
npm install pusher-js pusher3. Connect from a browser
Replace YOUR_APP_KEY with your key. The host and port are what make the library talk to Vixus Push; cluster is required by the library but not used.
import Pusher from "pusher-js";
const pusher = new Pusher("YOUR_APP_KEY", {
cluster: "", // not used; the host below decides where you connect
wsHost: "ws.push.vixus.io",
wsPort: 443,
wssPort: 443,
forceTLS: true,
enabledTransports: ["ws", "wss"],
});
const channel = pusher.subscribe("my-channel");
channel.bind("my-event", (data) => console.log(data));4. Publish from your server
Use your app id, key and secret. Read the secret from an environment variable, never from code you ship to a browser.
import Pusher from "pusher";
const pusher = new Pusher({
appId: "YOUR_APP_ID",
key: "YOUR_APP_KEY",
secret: process.env.PUSHER_APP_SECRET, // keep it on the server
host: "ws.push.vixus.io",
port: "443",
useTLS: true,
});
await pusher.trigger("my-channel", "my-event", { hello: "world" });5. See it arrive
Run the browser code, then run the server code. The browser logs { "hello": "world" }.
Your app's Live demo tab shows the same round trip with two browsers and your real credentials, plus the code behind it.
Next steps
- Channels: public, private and presence.
- Authentication: let only the right people subscribe to private channels.
- Limits and quotas: what your plan includes.