Skip to main content

Using LaserStream WebSocket

LaserStream WebSocket gives you a simple WebSocket integration and is available on all Helius plans, making it a convenient choice for developers. This example uses Solana’s logsSubscribe method, so you receive log messages only.

LaserStream WebSocket is up to 200 ms faster than the standard Agave RPC-based WebSocket implementation.

How it works

Connect to the LaserStream WebSocket endpoint, subscribe to logs mentioning the Pump AMM program, and process the incoming log data. The example below includes automatic reconnection logic with exponential backoffs.

Requirements

  • Node.js ≥ 18 (tested with v20)
  • TypeScript ≥ 5 if you plan to run the .ts samples with ts‑node
  • Any Helius plan – works with all plan tiers
  • An environment variable named HELIUS_API_KEY that stores your API key
Install dependencies globally: npm i -g typescript ts‑node

Implementation

1

Install Dependencies

2

Create the WebSocket Client

Create a file named standard-ws-pump.ts with the following code:
3

Set Environment Variables

Add your Helius API key as an environment variable:
Replace your-helius-api-key with your actual Helius API key from the dashboard.If you don’t have an API key, sign up or have your agent create one programmatically with the Helius CLI.
4

Run the Application

Execute the script to start streaming Pump AMM data:
You will receive log messages that mention the Pump AMM program. To fetch the full transaction, call getTransaction with the signature from the log entry.

Key benefits

  • Universal access - Available on all Helius plans, including free tier
  • Lightweight - Minimal data transfer since only logs are streamed, not full transactions
  • Easy to implement - Uses standard Solana RPC WebSocket protocol
  • Low barrier to entry - Perfect for prototyping and initial monitoring

Getting full transaction details

Since the Standard WebSocket only provides log messages, you’ll need an additional step to get complete transaction data:

Common issues and solutions

Verify your HELIUS_API_KEY is correct.
Ensure the Pump AMM program address is correct and there is activity on the program.
Implement more robust reconnection logic or check network stability.