WebSocket
One connection, many topics: theses, mindshare, reasons, the trader wall and every live feed on one stream slot.
The door
builder plan and upOne WebSocket, many topics: theses and their classification, mindshare, reasons, the trader wall with its moves and minute marks, and every live feed, on one key and ONE stream slot. A Builder key's single stream is the whole live experience.
wss://pnl.meme/v1/ws
This is the socket to build on. Two older sockets stay served for clients built on them: /v1/fomo/ws, the single-feed theses socket (legacy), and /v1/fomo/compat/v2/ws, the FomoScan-compatible socket in that layout's frames. Both carry theses only, and each connection to them takes one of the plan's stream slots, as this one does.
Every frame either way is a schema in the FOMO Data API's OpenAPI document (WsClientFrame, WsServerFrame), and the /v1/ws path there carries each topic's params, frames, resume frame types and lowest plan. OpenAPI 3.1 JSON
Connect
- Send the key as Authorization: Bearer on the upgrade itself. Nothing rides in the query string: a URL with one is refused, because every hop logs a URL.
- A connection holds one of your plan's open streams, shared with every server-sent stream you hold (/v1/stream, /v1/fomo/stream, /v1/pump/stream, /v1/perps/stream). Opening it costs one request of the day; after that, one request per full page of events a topic pushes (100; pump callouts 25), the REST doors' price for the same rows.
- A refused upgrade answers before the 101 with the shared error shape: 400 a query string, 401 no key, 403 a plan with no stream, 429 every stream your plan holds is open or the day is spent, 503 admission could not be read.
import WebSocket from "ws";
const cursors = {}; // topic -> { frame type -> cursor }
const ws = new WebSocket("wss://pnl.meme/v1/ws", { headers: { Authorization: "Bearer pnl_..." } });
ws.on("open", () => ws.send(JSON.stringify({ type: "subscribe", topics: [
{ topic: "theses", params: { classify: true }, resume: cursors.theses },
{ topic: "mindshare", params: { window: "1h" } },
] })));
ws.on("message", (text) => {
const frame = JSON.parse(text);
if (frame.type === "subscribed") cursors[frame.topic] = { ...frame.cursors };
else if (frame.cursor) (cursors[frame.topic] ??= {})[frame.type] = frame.cursor;
console.log(frame.type, frame.topic, frame.data ?? frame);
});
Open streams per plan
Limits
Try it live
builder plan and upYour key, a topic, Connect: each frame lands as it is pushed, with how long after the store wrote it. A browser cannot put a key on a WebSocket upgrade, so the page opens the push door that serves the same topic beside the socket, on the same key check, stream slot and reader; the socket itself runs from the command under it. Opening costs one request of the day and holds one of your streams until you disconnect.
Subscribe
One frame subscribes to one or many topics. Each topic is checked against your plan as you ask for it: a topic your plan lacks is refused by name, with the plan that has it, and the others still subscribe. Subscribing to a topic you hold replaces it; unsubscribe names the topics to drop.
// traders names trader_id values the traders.roster frame lists (pump:<account id> or fomo:<handle>)
{"type":"subscribe","topics":[
{"topic":"theses","params":{"classify":true}},
{"topic":"perps_trades","params":{"market":"SOL","snapshot":true}},
{"topic":"perps_levels","params":{"market":"SOL"}},
{"topic":"mindshare","params":{"window":"1h","scope":"fomo"}},
{"topic":"traders","params":{"traders":["pump:8f1d…"]}},
{"topic":"smart"}
]}
// after a disconnect: the cursors you last held
{"type":"subscribe","topics":[{"topic":"theses","params":{"classify":true},
"resume":{"thesis":"812345","thesis.classified":"c1.1764021602000.ab12"}}]}
{"type":"unsubscribe","topics":["smart"]}
Topics
An event topic sends each event once with a cursor. A state topic sends a timestamped snapshot when you subscribe, then a replacement or a change only when the data moves.
The signal channels are /v1/stream's; the record kinds and pump callouts are the FOMO Data API's; reasons are the Reasons API's record.
Frames
Every frame is one JSON text message. type says what it is, topic which subscription it belongs to; an event frame carries cursor.
{"type":"perps_trade","topic":"perps_trades","cursor":"<signed cursor>","data":{"event_id":"fill_001","source":"hyperliquid","dex":"native","market":"SOL","wallet":"0x1111111111111111111111111111111111111111","side":"sell","price":125,"size":2,"notional_usd":250,"tid":"123","occurred_at":"2026-12-01T00:00:00.000Z","stored_at":"2026-12-01T00:00:00.100Z"}}
{"type":"perps_levels","topic":"perps_levels","market":"SOL","as_of":"2026-12-01T00:00:00Z","data":{"version":1,"revision":"…","status":"read","bands":[…],…}}
{"type":"ready","connection_id":"9f0c…","plan":"builder","topics":["theses","mindshare","reasons","traders","pump_callouts","trades","chain_trades","perps_trades","perps_levels","pump_wallet","token_traders","early","match","radar","live"],"recovery_ms":300000}
{"type":"subscribed","topic":"theses","params":{"classify":true},"cursors":{"thesis":"812300","thesis.classified":"c1.1764021600000."},"resumed":false,"replaced":false}
{"type":"error","topic":"smart","code":"plan_required","message":"smart is not included in the builder plan. It is available from the pro plan.","required_plan":"pro"}
{"type":"resync","topic":"theses","reason":"expired","recovery_ms":300000}
{"type":"thesis","topic":"theses","cursor":"812345","data":{"record_id":"cm4…","seq":812345,"handle":"alice","token_address":"7xKX…pump","text":"…","ingested_at":"2026-11-24T10:00:00.120Z",…}}
{"type":"thesis.classified","topic":"theses","cursor":"c1.1764021602000.ab12","data":{"record_id":"cm4…","thesis_key":"…","occurred_at":"…","completed_at":"2026-11-24T10:00:02.000Z","classification":{"status":"classified","reasons":[{"kind":"narrative","said_at":"…"}],"text_basis":"full","classified_at":"2026-11-24T10:00:02.000Z"},…}}
{"type":"mindshare","topic":"mindshare","data":{"window":"1h","scope":{"name":"fomo",…},"denominator":{"unit":"caller_token_pairs","value":412,…},"as_of":"2026-11-24T10:00:00.000Z","ranking":[{"id":"solana:7xKX…pump","rank":1,"mint":"7xKX…pump","ticker":"BONK","callers":31,"share":0.0752,…}]}}
{"type":"reasons","topic":"reasons","token":"solana:7xKX…pump","data":{"token":…,"reasons":[…],"voices":…,"mood":…,"read_at":"…"}}
{"type":"trader.removed","topic":"traders","as_of":"2026-11-24T10:05:00.000Z","data":{"trader_id":"pump:8f1d…"}}
{"type":"trader.move","topic":"traders","cursor":"b1.3f9a01c2.41","data":{"trader_id":"pump:8f1d…","move_id":"a41c…","move":{"id":"a41c…","kind":"buy","token":…,"usd":250,"at":"…"}}}
{"type":"chart.point","topic":"traders","key":"pump:8f1d…:solana:7xKX…pump:1764021600000","correction":false,"data":{"key":"…","trader":{"trader_id":"pump:8f1d…",…},"token":{"mint":"7xKX…pump","chain":"solana",…},"minute":"2026-11-24T10:00:00.000Z","cap_usd":4255.87,"mark_at":"2026-11-24T10:00:58.000Z","trade_at":null,"valuation":{"usd":120.4,"at":"…"}}}
{"type":"pump_callout","topic":"pump_callouts","cursor":"p1.1764021600000.co_81…","data":{"callout_id":"co_81…","coin_mint":"7xKX…pump",…}}
{"type":"trade","topic":"trades","cursor":"912001","data":{"record_id":"…","seq":912001,"side":"buy",…}}
{"type":"pump_trade","topic":"pump_wallet","cursor":"<signed arrival cursor>","data":{"wallet":"…","signature":"…","side":"buy","observedAt":"…",…}}
{"type":"token_trade","topic":"token_traders","cursor":"t1.91234567.912001","data":{"token":"7xKX…pump","at":"…","side":"buy","usd":250,"source":"chain","signature":"…","trader_id":"cmv…","board":{"rank":4,"handle":"…",…},"fomo":null,"handle":"…"}}
{"type":"signal","topic":"early","cursor":"b1.3f9a01c2.17","data":{…}}
{"type":"checkpoint","topic":"pump_callouts","cursors":{"pump_callout":"p1.1764021660000.mark"}}
Reconnect and recover
- After a network disconnect or server restart, use exponential backoff and randomize each reconnect delay. If a server stops abruptly while your key is at its stream limit, reconnects can return HTTP 429 until the previous lease expires, up to 60 seconds after its last renewal.
- Keep, per topic, the cursor of the last frame of each type you received, starting from the cursors the subscribed frame names (including checkpoints on the pump callout and perps fill feeds). Reconnect and subscribe with resume: { <frame type>: <cursor> }.
- The recovery window is 5 minutes, measured on the oldest event you missed: inside it, every missed event is replayed in order, then the topic is live. Past it the server sends resync and the topic starts again from now; refetch what you need from the REST doors.
- The record kinds resume on their own sequence (the same id /v1/fomo/stream sends), pump callouts on their p1 id, wallet activity on its signed arrival cursor, and classification revisions on their own cursor. If a signal or trader-move board sends resync with reason unknown_cursor, discard its old b1. cursor and save the cursor from the new subscribed frame.
- For perps_trades, save each perps_trade or checkpoint cursor. GET /v1/perps/stream?market=SOL accepts it in Last-Event-ID or cursor for the same key, market and wallet filter. After a WebSocket resync, snapshot: true gives a fresh recent window. SSE returns 410 for an expired cursor. Each 100 fills delivered on a subscription costs one further request.
- Omit resume when resubscribing to a state topic for a fresh, timestamped snapshot. Replace all saved perps_levels bands for that market on each revision.
What a subscriber costs
Nothing upstream. Every topic reads what the server already reads once for everyone: the FOMO tail, the pump window, the channel reads behind /v1/stream and the stored reasons, rankings and marks. A read is shared only between subscribers asking the same question with the same permitted data, so a thousand sockets cost what one does.