Documentation Index
Fetch the complete documentation index at: https://www.helius.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
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 methodsEndpoints
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
Account Subscriptions
Account Subscriptions
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
Program Subscriptions
Program Subscriptions
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
Transaction Subscriptions
Transaction Subscriptions
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
Slot Subscriptions
Slot Subscriptions
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:- Processed
- Confirmed
- Finalized
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 samewss://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 signatureaccountSubscribe— Helius adds advanced filters on top of the standardaccountSubscribeshape
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
Network Issues
Network Issues
- Internet connectivity problems
- WiFi handoffs on mobile devices
- Corporate firewall timeouts
- ISP routing changes
Server-Side Events
Server-Side Events
- Planned maintenance windows
- Load balancer restarts
- RPC node updates
- Temporary overload protection
Client-Side Issues
Client-Side Issues
- Browser tab backgrounding
- Mobile app suspension
- Computer sleep/hibernation
- Process crashes or restarts
Detecting Disconnections
- JavaScript/Browser
- Node.js
Reconnection Strategies
- Exponential Backoff
- Circuit Breaker Pattern
Testing Reconnection Logic
- Network Simulation
- Automated Testing
Troubleshooting
Connection Failed
Connection Failed
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
Frequent Disconnections
Frequent Disconnections
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
Missing Messages
Missing Messages
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
High Latency
High Latency
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
Memory Leaks
Memory Leaks
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