Live Dashboards
Build real-time dashboards that update instantly as data changes.
Overview
Real-time dashboards provide immediate visibility into your business metrics. With NoLag, you can push updates to dashboards the moment data changes, without polling or page refreshes.
Dashboard Setup
import { NoLag } from '@nolag/js-sdk'
const client = NoLag('your_access_token')
await client.connect()
const dashboard = client.setApp('analytics').setRoom('live')
// Subscribe to real-time metrics
dashboard.subscribe('page-views')
dashboard.subscribe('active-users')
dashboard.subscribe('sales')
// Update charts in real-time
dashboard.on('page-views', (data) => {
pageViewsChart.update(data.count, data.timestamp)
})
dashboard.on('active-users', (data) => {
activeUsersGauge.setValue(data.count)
})
dashboard.on('sales', (data) => {
salesChart.addDataPoint(data.amount, data.timestamp)
totalSales.increment(data.amount)
})Use Cases
- Analytics dashboards - Page views, user sessions, conversion rates
- Sales dashboards - Revenue, orders, inventory levels
- Operations dashboards - Server health, error rates, response times
- Trading dashboards - Stock prices, market data, portfolio values
Architecture
- Backend services publish metrics to NoLag topics
- Dashboard clients subscribe to relevant topics
- Charts and gauges update in real-time as data arrives
Best Practices
- Use separate topics for different metric types
- Batch updates for high-frequency data to reduce rendering overhead
- Use hydration webhooks to load initial dashboard state
- Consider data retention and historical data storage separately