Real-time data streaming with WebSocket connections for live vehicle telemetry, system events, and analytics.
Real-time vehicle sensor data and status updates
Platform events and status notifications
Real-time analytics and metrics
import { LattisNexusClient } from '@lattis-nexus/sdk';
const client = new LattisNexusClient({
apiKey: 'your_api_key'
});
// Subscribe to vehicle telemetry stream
client.stream.subscribe('vehicle_telemetry', {
vehicleId: 'v123',
events: ['location_update', 'speed_reading']
}, (data) => {
console.log('Received telemetry:', data);
});
// Handle connection events
client.stream.on('connected', () => {
console.log('Connected to WebSocket');
});
client.stream.on('error', (error) => {
console.error('WebSocket error:', error);
});from lattis_nexus import Client
import asyncio
client = Client(api_key='your_api_key')
async def handle_telemetry(data):
print(f"Received telemetry: {data}")
async def main():
# Subscribe to vehicle telemetry stream
await client.stream.subscribe(
'vehicle_telemetry',
vehicle_id='v123',
events=['location_update', 'speed_reading'],
callback=handle_telemetry
)
# Handle connection events
client.stream.on_connected(lambda: print("Connected to WebSocket"))
client.stream.on_error(lambda e: print(f"WebSocket error: {e}"))
await client.stream.connect()
asyncio.run(main())Implement proper reconnection logic with exponential backoff
Handle connection errors and data parsing failures gracefully
Process incoming data efficiently to prevent bottlenecks
Maintain proper state for subscribed streams and events
Experience real-time data streaming with our interactive WebSocket demo. Connect to a test stream and see live data in action.