Skip to content
TipPage Docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Realtime WebSocket

Stream every TipPage event live over a plain WebSocket - no SDK, any language. Connect with your API key, or hand short-lived tokens to clients that shouldn't see it.

The webhook events, live over a WebSocket at wss://ws.tippage.com. Same envelope, same event id. Webhooks are retried for ~44 hours; the stream only delivers what happens while you’re connected. Use the stream to react now, webhooks when nothing may be lost - or both, deduped on id.

Connecting

Any WebSocket client works. Send one JSON line, then just receive:

const ws = new WebSocket("wss://ws.tippage.com");
ws.onopen = () => ws.send(JSON.stringify({ data: { apiKey: process.env.TIPPAGE_API_KEY } }));
ws.onmessage = (e) => {
  const frame = JSON.parse(e.data);
  if (!frame.pub) return;          // connect frame or {} keepalive
  const event = frame.pub.data;    // the webhook envelope
  console.log(event.type, event.data);
};
{ "connect": { "client": "...", "subs": { "dev:t_abc123:tts": {} }, "ping": 25,
    "data": { "type": "welcome", "message": "...", "node": "...", "server_time": "..." } } }   // first frame
{ "channel": "dev:t_abc123:tts", "pub": { "data": { "id": "evt_...", "type": "tip.created", ... } } }
{}   // keepalive, ~every 25s

Close codes

The server says why it closed the socket in the WebSocket close frame (event.code, event.reason). The range tells you what to do:

Range What to do
3000-3499 Reconnect with backoff. Nothing is wrong with your credential.
3500-3999, 4500-4999 Don’t reconnect as you are. Fix the request or the credential first.
1006, or no code The connection dropped without a close frame (network, proxy). Reconnect with backoff.

The ones you will see:

Code Reason Meaning
3001 shutdown The server you were on is restarting, usually as part of a new deployment from us. Reconnect - another server should take you straight away (hopefully).
3004 internal server error Something failed on our side. Reconnect.
3005 expired Your credential could not be confirmed on a routine check. Reconnect and cross your fingers! If the key you are using is good you should be accepted.
3008 slow Your client was not reading fast enough and the backlog grew too large. Reconnect, and read the socket without blocking.
3501 bad request The first message was not the JSON connect line.
4501 Bad key, or an expired/malformed token
4507 No realtime-capable scopes
4508 Key rotated, disabled, deleted or re-scoped (checked about every 30s)

Events sent while you are reconnecting are not replayed. Use webhooks for anything that must not be missed.

Handoff tokens

Your key never goes to a browser, an app you ship or anyone else’s machine. For those, your server mints a short-lived token:

curl -X POST https://api.tippage.com/v1/realtime/token \
  -H "Authorization: Bearer tp_live_..." -H "Content-Type: application/json" \
  -d '{"groups": ["tts", "twitch"], "expires_in": 900}'
{ "url": "wss://ws.tippage.com", "token": "eyJ...",
  "expires_at": "2026-09-02T09:15:00.000Z", "channels": ["dev:t_abc123:tts", "dev:t_abc123:twitch"] }

The client connects with { "data": { "token": "..." } }. The token can only open a stream, must be used within expires_in (60-3600s, default 900), and the socket then stays up past it - a reconnect needs a fresh token. groups is optional and can only narrow what the key’s scopes grant (group_not_granted otherwise).

Channels and scopes

Each group your scopes allow becomes a channel dev:<tenant>:<group>:

Group Granted by Events
tts tts:read tip.*, tipping.*, queue.tts.*
media media:read media.created, queue.media.*
twitch tts:read or channel_points:manage twitch.*, alert.replayed, alert.finished
kick tts:read kick.*, alert.replayed, alert.finished
chat commands:manage or chat:write chat.command, chat.moderated, character.* - both platforms, data.platform says which
messages chat:read chat.message - every chat line, both platforms. Realtime only
counters counters:manage counter.updated
overlays overlays:manage overlay.connected, overlay.disconnected

Switch on event.type. Payloads are in the event catalog and at GET /v1/events.

alert.finished is realtime only, never a webhook: the alert box has stopped showing an alert (it played or was skipped), on the channel of the alert’s platform, with data.event_id, data.platform, data.outcome (played | skipped) and data.alert - the row as GET /v1/alerts/history lists it, so a feed can add it without a read.

alert.replayed is its twin for a replay: the moment one is pressed (in the dashboard or through POST /v1/alerts/{id}/replay) the NEW row goes out on the alert’s platform channel - data.event_id (the new id), data.replay_of, data.parked (no overlay was connected; it plays on the next connect) and data.alert with status: "waiting" and is_replay: true - so a feed shows the replay at once; alert.finished follows for the same id when the box is done.

Chat messages

With chat:read, every line typed in the streamer’s Twitch and Kick chat arrives as chat.message on the messages channel. It is realtime only: chat is never sent to webhooks and is not in GET /v1/events. Lines start within a few seconds of connecting and are not replayed after a reconnect.

{
  "id": "evt_...", "type": "chat.message", "created": "2026-11-15T10:00:00.000Z", "actor": null,
  "data": {
    "platform": "twitch",
    "channel": { "id": "100", "login": "streamer" },
    "message_id": "b1c2...",
    "type": "text",
    "text": "hello Kappa",
    "user": { "id": "200", "login": "viewer", "display_name": "Viewer", "color": "#FF0000" },
    "badges": [{ "set_id": "subscriber", "id": "12", "info": "14" }],
    "roles": { "broadcaster": false, "moderator": false, "vip": false, "subscriber": true },
    "emotes": [{ "id": "25", "name": "Kappa" }],
    "bits": 0,
    "reward_id": null,
    "reply": null,
    "shared_chat": null,
    "sent_at": null
  }
}
  • type is Twitch’s message type (text, channel_points_highlighted, user_intro, …); always text on Kick.
  • badges[].info is the sub month count on a subscriber badge. On Kick id is null.
  • reply is { message_id, user_id, login, text } when the line answers another.
  • shared_chat is { source_channel_id, source_message_id } for a line typed in another channel of a Twitch shared chat. Skip those if you only want this channel’s own chat.
  • sent_at is set on Kick only; use the envelope’s created otherwise.
  • The bot’s own lines are included. A line that chat moderation removes still arrives first; chat.moderated follows on the chat channel.
  • Twitch chat is read only while the bot is switched on for Twitch. Kick chat always is.

A busy chat is a lot of messages. Request the messages group only on connections that use it (groups on the token).

overlay.connected means the overlay’s realtime connection is up, not just the page loaded. Disconnects arrive after a short grace window (a clean close in ~5-10s, a crash in ~10-25s), so a reload doesn’t fire one.

Other hosts

  • wss://dev-ws.tippage.com is an old alias of this endpoint and still works.
  • wss://realtime.uk-london.platform.tippage.com is TipPage’s internal overlay transport. It changes without notice - don’t build on it or imitate an overlay. To replace the overlay, use this stream plus claim and finish.