Realtime TIP_ALERT
Available Entrypoints
Section titled “Available Entrypoints”From the authenticated client
Section titled “From the authenticated client”const listener = await client.tipAlerts.createListener();This variant resolves the current user first and then opens the realtime connection for that userId.
From a widget URL
Section titled “From a widget URL”const listener = client.tipAlerts.fromWidgetUrl( "https://widgets.tipply.pl/TIP_ALERT/user-123",);From the public client and a known userId
Section titled “From the public client and a known userId”const me = await authenticatedClient.me.get();const listener = publicClient.user(me.id).tipAlerts.createListener();Listener Lifecycle
Section titled “Listener Lifecycle”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();Listener Contract
Section titled “Listener Contract”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;}Events
Section titled “Events”readydonationdisconnecterror
The donation payload is normalized to TipAlertDonation and includes fields such as id, nickname, message, amount, audioUrl, goalId, createdAt, and raw.
Connection Options
Section titled “Connection Options”type TipAlertsListenerOptions = { reconnect?: boolean;};Example:
const listener = publicClient.tipAlerts.fromWidgetUrl( "https://widgets.tipply.pl/TIP_ALERT/user-123", { reconnect: false },);Skip The Current Alert
Section titled “Skip The Current Alert”skipCurrent() is available only on the authenticated client:
await client.tipAlerts.skipCurrent();Clean Shutdown
Section titled “Clean Shutdown”const shutdown = () => { listener.destroy(); process.exit(0);};
process.on("SIGINT", shutdown);process.on("SIGTERM", shutdown);