How to Stream Pump.fun Token Launches via WebSocket (Node.js)
Stream every new Pump.fun token launch in real time with the Solana Tracker Datastream. Working Node.js example with filtering — live in 5 minutes.
Introduction
Polling a REST endpoint for new launches is always too late: by the time your interval fires, a bot with an open WebSocket connection has already acted. In this tutorial you open a Datastream connection and receive every new Pump.fun mint within milliseconds of block confirmation.
What you need
- Node.js 18+
- A Solana Tracker API key (free) and Datastream key (Premium+, same dashboard)
- 5 minutes
Step 1 — Install the SDK
npm install @solana-tracker/[email protected] ws
Step 2 — Connect to the Datastream
import WebSocket from 'ws';
(globalThis as any).WebSocket = WebSocket;
const { Datastream } = await import('@solana-tracker/data-api');
const ds = new Datastream({ wsUrl: `wss://datastream.solanatracker.io/${process.env.ST_DATASTREAM_KEY}` });
ds.on('connected', () => console.log('Connected to Datastream'));
ds.connect();
Step 3 — Subscribe to new Pump.fun launches
ds.subscribe.latest().on((token) => {
const market = token.pools[0]?.market;
if (market !== 'pumpfun') return;
console.log('New launch:', token.token.name, token.token.mint);
});
Step 4 — Filter out the noise
Most fresh mints are worthless. Filter directly on the fields included in the payload:
ds.subscribe.latest().on((token) => {
const pool = token.pools[0];
if (pool?.market !== 'pumpfun') return;
if ((token.risk?.score ?? 0) < 6) return;
if ((pool.liquidity?.usd ?? 0) < 3000) return;
console.log('Promising launch:', token.token.name, token.token.mint, token.risk.score);
});
The Datastream sends a 1-10 risk score with each token (snipers, bundlers, insiders, authorities), so you don't have to build that layer yourself.
Step 5 — Wire it to an action
For example, send a Telegram alert or trigger your trade logic:
async function alert(token) {
await fetch(`https://api.telegram.org/bot${BOT}/sendMessage`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
chat_id: CHAT_ID,
text: `New launch: ${token.token.name}\nMint: ${token.token.mint}\nRisk: ${token.risk.score}/10`,
}),
});
}
FAQ
How fast do launches arrive?
Within sub-second latency on paid tiers, measured from block confirmation.
Do I need gRPC?
No. For most launch scanners the WebSocket Datastream is fast enough and much quicker to build. For raw program-level detection you can add Yellowstone gRPC.
Can I listen to multiple markets at once?
Yes — omit the market filter to receive all DEXes, or subscribe to separate rooms.
Next: Detect Pump.fun graduations → · Full reference on the Pump.fun API page.
Download the example
Clone the full runnable project on GitHub — npm install && npm start with your keys in .env. Or open it in StackBlitz to run in your browser (free). See the tutorial for step-by-step context.
Runnable Node.js project — clone from GitHub, add keys to .env, then npm start. StackBlitz runs REST and Datastream examples in your browser for free.