Skip to main content

What is LaserStream WebSocket?

LaserStream WebSocket is the WebSocket-protocol variant of LaserStream. It serves the standard Solana JSON-RPC subscription methods (accountSubscribe, programSubscribe, logsSubscribe, signatureSubscribe, slotSubscribe, …) alongside Helius-specific extensions like transactionSubscribe for advanced filtering — all on the same unified wss://mainnet.helius-rpc.com endpoint and on the same LaserStream backend as the gRPC product. WebSockets give you a persistent, real-time connection: instead of repeatedly polling “has anything changed?”, the blockchain notifies you the moment something happens.

Real-Time Updates

Get instantly notified when Solana accounts change, transactions occur, or when new blocks are produced

Efficient Resource Usage

One persistent connection instead of polling hundreds of HTTP requests

Low Latency

Up to 200 ms faster than standard Agave RPC-based WebSockets, served by LaserStream

Helius Extensions

transactionSubscribe and an enhanced accountSubscribe for advanced filtering on top of the standard Solana methods

Endpoints

WebSockets — both the standard Solana methods and the Helius-specific extensions — are served from a single unified endpoint per network: Mainnet: wss://mainnet.helius-rpc.com/?api-key=<API_KEY> Devnet: wss://devnet.helius-rpc.com/?api-key=<API_KEY>

Gatekeeper (Beta)

To test our fastest WebSocket offering, try the new Gatekeeper (Beta) endpoint: wss://beta.helius-rpc.com/?api-key=<API_KEY>

Pricing & Metering

WebSocket usage is metered at 2 credits per 0.1 MB of streamed data. Opening a connection costs 1 credit. For high-volume workloads on Professional plans, Data Add-Ons provide monthly data allowances (5TB–100TB) at predictable costs. Data add-ons can be applied to LaserStream and WebSockets.
The Helius-specific methods transactionSubscribe and accountSubscribe (with Helius filters) require a Developer, Business, or Professional plan. Standard Solana methods like programSubscribe, logsSubscribe, and signatureSubscribe are available on all plans.

Core Concepts

Subscription Types

Monitor changes to specific accounts like wallet balances, token accounts, or program data.Use cases:
  • Wallet balance tracking
  • Token account monitoring
  • Smart contract state changes
  • NFT ownership updates
Watch all accounts owned by a specific program for any changes.Use cases:
  • DEX trade monitoring
  • DeFi protocol tracking
  • NFT marketplace activity
  • Gaming asset changes
Get notified when specific transactions are confirmed or when transactions mention certain accounts.Use cases:
  • Payment confirmations
  • Transaction status tracking
  • Multi-signature approvals
  • Contract execution monitoring
Monitor blockchain progression and finality at the slot level.Use cases:
  • Block explorer applications
  • Network health monitoring
  • Consensus tracking
  • Performance analytics

Commitment Levels

Understanding commitment levels is crucial for reliable applications:
Fastest - Transaction processed by a validator but not confirmed
  • Latency: ~400ms
  • Risk: Can be dropped or reordered
  • Use for: Real-time UI updates (with caution)
Want to learn more about commitment levels? Read our comprehensive blog post: Understanding Solana Commitment Levels

Available WebSocket Methods

Helius supports the full set of Solana WebSocket subscription methods, plus Helius-specific extensions. All methods share the same wss://mainnet.helius-rpc.com endpoint.

Helius extensions

Two methods deliver richer filtering than the Solana standard:
  • transactionSubscribe — subscribe to transactions matching include/exclude/required account lists, vote/failed flags, and a specific signature
  • accountSubscribe — Helius adds advanced filters on top of the standard accountSubscribe shape

Standard Solana methods

accountSubscribe, blockSubscribe, logsSubscribe, programSubscribe, rootSubscribe, signatureSubscribe, slotSubscribe, slotsUpdatesSubscribe, voteSubscribe and their corresponding *Unsubscribe pairs.

Complete API Reference

Explore all 18+ WebSocket methods. Each method includes detailed parameters, response formats, and examples.

How to Implement Reconnection Logic

WebSocket connections can disconnect for various reasons - network issues, server maintenance, or temporary outages. Production applications must implement reconnection logic to ensure reliability.

Why Disconnections Happen

  • Internet connectivity problems
  • WiFi handoffs on mobile devices
  • Corporate firewall timeouts
  • ISP routing changes
  • Planned maintenance windows
  • Load balancer restarts
  • RPC node updates
  • Temporary overload protection
  • Browser tab backgrounding
  • Mobile app suspension
  • Computer sleep/hibernation
  • Process crashes or restarts

Detecting Disconnections

Reconnection Strategies

Testing Reconnection Logic

Critical for Production: Implementing proper reconnection logic is not optional for production applications. WebSocket connections will disconnect - plan for it, test it, and monitor it in production.

Troubleshooting

Symptoms: WebSocket fails to connect initiallySolutions:
  • Verify your API key is correct and has sufficient credits
  • Check the endpoint URL format: wss://mainnet.helius-rpc.com?api-key=YOUR_KEY
  • Ensure your firewall allows WebSocket connections on port 443
  • Test with a simple ping first to verify basic connectivity
Symptoms: Connection drops every few minutesSolutions:
  • WebSockets have a 10-minute inactivity timer. Send a ping at least once per minute to keep the connection alive (see the reconnection examples above and the WebSocket FAQ)
  • Implement proper ping/pong heartbeat (shown in reconnection examples above)
  • Check your network stability and corporate firewall settings
  • Monitor your subscription count - too many can cause instability
  • Verify you’re handling the connection lifecycle properly
Symptoms: Not receiving expected subscription updatesSolutions:
  • Verify your subscription is confirmed (check the response)
  • Ensure the account/program you’re monitoring has actual activity
  • Monitor your connection state - missed messages often indicate disconnections
Symptoms: Slow message delivery, delays in updatesSolutions:
  • Use “confirmed” instead of “finalized” commitment
  • Reduce the number of active subscriptions
  • Optimize your message processing logic
  • Consider using multiple connections to distribute load
  • Check your network connection quality
Symptoms: Application memory usage grows over timeSolutions:
  • Implement proper subscription cleanup
  • Remove event listeners when components unmount
  • Clear message logs periodically
  • Monitor subscription count and enforce limits
  • Use weak references for callback functions where possible

Migration from Standard RPC

If you’re currently using HTTP polling, here’s how to migrate to WebSockets:

Enhanced Capabilities

For apps requiring even more advanced features, consider using LaserStream gRPC:

24-Hour Historical Replay

Catch up on missed data when your app was offline

Multi-Node Aggregation

Better reliability via data from multiple validators

Higher Throughput

Handle more subscriptions and higher message rates

Enterprise Features

Advanced monitoring, analytics, and data pipelines

Get Started

Ready to Get Started? Check out our WebSocket Quickstart Guide for practical examples and a step-by-step implementation.