Skip to content

Realtime TIP_ALERT

const listener = await client.tipAlerts.createListener();

This variant resolves the current user first and then opens the realtime connection for that userId.

const listener = client.tipAlerts.fromWidgetUrl(
"https://widgets.tipply.pl/TIP_ALERT/user-123",
);
const me = await authenticatedClient.me.get();
const listener = publicClient.user(me.id).tipAlerts.createListener();
listener.on("ready", () => {
console.log("Connected");
});
listener.on("donation", (donation) => {
console.log(donation.nickname, donation.amount);
});
listener.on("disconnect", (reason) => {
console.log("Disconnected:", reason);
});
listener.on("error", (error) => {
console.error(error);
});
await listener.connect();
interface TipAlertsListener {
readonly userId: UserId;
readonly connected: boolean;
connect(): Promise<void>;
destroy(): void;
on(event, listener): this;
once(event, listener): this;
off(event, listener): this;
removeAllListeners(event?): this;
}
  • ready
  • donation
  • disconnect
  • error

The donation payload is normalized to TipAlertDonation and includes fields such as id, nickname, message, amount, audioUrl, goalId, createdAt, and raw.

type TipAlertsListenerOptions = {
reconnect?: boolean;
};

Example:

const listener = publicClient.tipAlerts.fromWidgetUrl(
"https://widgets.tipply.pl/TIP_ALERT/user-123",
{ reconnect: false },
);

skipCurrent() is available only on the authenticated client:

await client.tipAlerts.skipCurrent();
const shutdown = () => {
listener.destroy();
process.exit(0);
};
process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);