See it in action: Check out our Live Streaming Dashboard to see real-time price updates across multiple chains before you build your own.
Tutorial overview
In this tutorial, you’ll learn how to:- Connect to the DexPaprika streaming API
- Receive real-time price updates
- Handle connection errors gracefully
- Build a simple price display
Step 1: Choose Your Asset
For this tutorial, we’ll stream the price of Ethereum (WETH).Finding Token Addresses
Use the REST API to find token addresses:- Search by name or symbol using the Search Endpoint:
- Get network list using the Networks Endpoint:
Common Token Addresses
Or use these verified addresses for popular tokens:- Ethereum
- Solana
- BSC
Step 2: Test with cURL
First, let’s verify the stream works with a simple cURL command:Step 3: JavaScript Implementation
Here’s how to connect to the streaming API using JavaScript:🎯 Live Example: See this code in action in our Interactive Streaming Dashboard - watch 6 tokens stream live across Ethereum, Solana, and BSC with real-time updates, connection status, and latency monitoring.
Step 4: Customize Your Stream
Stream Different Tokens
Modify the URL parameters to stream any token:Add Multiple Assets
To stream multiple assets, switch to the POST method:Understanding the Code
Key Components
EventSource API
EventSource API
The It automatically handles:
EventSource API is the browser’s built-in way to handle SSE:- Persistent connections
- Automatic reconnection
- Event parsing
Error Handling
Error Handling
The
onerror callback handles disconnections:Price Updates
Price Updates
Each event contains:
Implementation Notes
Browser Support
- EventSource API works in all modern browsers
- For direct browser connections, you’ll need to handle CORS (use a backend proxy)
- No issues when streaming from server-side (Node.js, Python, etc.)
Best Practices
- Implement exponential backoff for reconnection
- Handle both connection errors and SSE error events
- Parse prices as floats to maintain precision
- Close connections properly on page unload
See It Live
🚀 Live Streaming Dashboard
Experience the API in action! Our interactive demo streams 6 cryptocurrencies in real-time across Ethereum, Solana, and BSC. Watch live price updates, connection status, latency metrics, and update statistics. Built with React and deployed on Vercel - perfect reference implementation showing POST /stream with multiple assets.What you’ll see:
- Real-time price updates every ~1 second
- Multi-chain token streaming (ETH, SOL, BSC)
- Live connection status and latency
- Price change indicators and trends
- Total updates and uptime metrics
Next Steps
Congratulations! You’ve built your first streaming application. Here’s what to explore next:React Integration
Create reusable React components for streaming.
Stream Multiple Assets
Learn POST /stream to efficiently track multiple tokens.
Portfolio Tracker
Track your entire portfolio value in real-time.
Production Best Practices
Learn error handling, monitoring, and scaling.