Twitch Chat Firehose
A public, real-time stream of Twitch chat messages, user notices, timeouts, and bans received.
Watch it live
Lurkology
Open LurkologyConnect a client
The default stream (no query parameters, and explicitly ?jsonBasic=true or ?json=true) sends the structured JSON payload described below. Add ?raw=true to receive the original Twitch IRC wire line as plain text instead. Each of these also accepts =1 in place of =true.
raw=true or raw=1 takes precedence over JSON options. Other values, including raw=false, use JSON. ?irc=true does not select raw output; use ?raw=true.
Each IP can have up to two active connections. Public connections are accepted only while the total connected client count is below 50. Whitelisted API keys allow backend services to connect above that total, but their connections still count toward public capacity and the per-IP limit.
Whitelisted backend clients authenticate with an Authorization: Bearer <api-key> header. Supplied keys must be valid and firehose-whitelisted; otherwise the connection closes with code 1008. Browser clients remain public. Changes to key whitelisting or revocation affect new connections; existing connections remain active.
Excess concurrent connections close with code 1008 without an IP ban. More than 100 connection attempts per minute per IP trigger a temporary ban, so reconnect with backoff.
Browser JavaScript (JSON, the default)
const socket = new WebSocket("wss://firehose.catquery.com/firehose");
socket.addEventListener("open", () => {
console.log("Connected to the CatQuery firehose");
});
socket.addEventListener("message", (event) => {
const message = JSON.parse(event.data);
console.log(`#${message.channel} <${message.displayName}> ${message.text}`);
});
socket.addEventListener("close", () => {
console.log("Disconnected; reconnect with backoff if needed");
});
Node.js with ws (raw IRC)
import WebSocket from "ws";
const socket = new WebSocket("wss://firehose.catquery.com/firehose?raw=true");
socket.on("message", (data) => {
console.log(data.toString());
});
Whitelisted Node.js backend
import WebSocket from "ws";
const socket = new WebSocket("wss://firehose.catquery.com/firehose", {
headers: { Authorization: "Bearer " + process.env.CATQUERY_API_KEY },
});
Payload format
By default (and with ?jsonBasic=true or ?json=true), every WebSocket message is one JSON object with this shared shape. With ?raw=true, the server instead sends the raw IRC line as plain text.
The JSON payload does not include a raw field. Raw mode sends one original IRC line per WebSocket message, including its command and tags.
{
"text": "Kappa",
"username": "foobar",
"displayName": "FooBar",
"channel": "xqc",
"timestamp": "2025-11-22T06:11:26.537Z",
"id": "8939f358-4118-4fb6-86ee-4bba89a1de8e",
"tags": {
"color": "#000000",
"badges": "subscriber/12",
"emotes": "25:0-4",
"room-id": "29400754",
"user-id": "60458761",
"first-msg": "0"
}
}
| Field | Type | Meaning |
|---|---|---|
text | string | Chat text or a human-readable event description. |
username | string, optional | Lowercase Twitch login. It can be absent on moderation events. |
displayName | string | The sender's display name, or the affected username for a moderation event. |
channel | string | Lowercase channel login, without #. |
timestamp | string | UTC timestamp in ISO 8601 format. |
id | string | Twitch message ID for chat messages and user notices. Timeout and ban events use an empty string. |
tags | object | String-valued tags. Chat messages and user notices retain the original IRC tags; timeout and ban events use the normalized tags described below. Optional tags may be absent or empty. |
Useful chat tags include badges, badge-info, color, emotes, first-msg, room-id, and user-id. Treat unknown tags as forward-compatible additions.
Event types
Chat messages
Normal Twitch PRIVMSG events have a non-empty id, a username, and the standard chat tags shown above.
User notices
Subscriptions, raids, announcements, and similar Twitch USERNOTICE events have tags["event-type"] === "usernotice". When system-msg is nonempty, text starts with that system message, followed by one separator space if user-entered text is present. Announcements with an empty system-msg contain only the user-entered text, with its whitespace preserved. Original Twitch tags and emote positions are retained; emote positions refer to the user-entered text, excluding any system-message prefix.
Timeouts and permanent bans
Moderation CLEARCHAT events have an empty id, no username, and include target-user-id. A non-empty ban-duration means a timeout; an empty value means a permanent ban.
displayName contains the affected user's login. text is <username> has been timed out for <duration> seconds or <username> has been permanently banned. Both tags["user-id"] and tags["target-user-id"] identify that user. Other normalized tags include tmi-sent-ts and room-id, with empty values for chat-only tags such as badges and emotes.
Channel-wide chat clears and individual message deletions (CLEARMSG) are not broadcast.
function eventType(event) {
if (event.tags["event-type"] === "usernotice") return "usernotice";
if (event.id === "" && event.tags["target-user-id"]) {
return event.tags["ban-duration"] ? "timeout" : "ban";
}
return "message";
}
Usage and reliability notes
- This is a live broadcast, not a history API. Events sent before you connect are not replayed.
- The stream combines CatQuery's directly joined channels and configured external IRC sources. External sources can contribute channels CatQuery has not directly joined. Coverage depends on the active sources; it is not every message sent across all of Twitch.
- Delivery is best effort. If a client's outgoing buffer exceeds 16 MiB, new events for that client are silently dropped until its buffer drains, even while the connection remains open. Missed events are not replayed. Clients with the largest buffers may also be disconnected when the server's total buffer budget is exceeded.
- Connections can close during deployments, network interruptions, or if a client cannot consume data quickly enough. Reconnect with exponential backoff and jitter.
- Each IP address is limited to two simultaneous connections; extras are rejected without a ban. More than 100 connection attempts per minute triggers escalating temporary blocking. Public clients can join only while the total client count is below 50; whitelisted API keys can connect above that total.