Set up sub-10ms global routing with automatic failover and protocol translation
MESH makes routing decisions in <10ms by analyzing:
Then routes the stream to the optimal region automatically.
const meshConfig = {
routing: {
policy: 'geo-latency',
regions: [
{ code: 'us-east', priority: 1 },
{ code: 'us-west', priority: 2 },
{ code: 'eu-west', priority: 3 }
]
},
failover: {
enabled: true,
switchoverTime: 500 // ms
},
protocolTranslation: {
source: 'rtmp',
targets: ['webrtc', 'srt']
}
};// Configure MESH routing via API
const response = await fetch('/api/v1/mesh/configure', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${WAVE_API_KEY}`
},
body: JSON.stringify({
streamId: 'stream-123',
meshConfig: {
routing: {
policy: 'geo-latency',
regions: ['us-east', 'us-west', 'eu-west']
},
failover: {
enabled: true,
switchoverTime: 500
}
}
})
});
const result = await response.json();
console.log('MESH configured:', result);// Monitor MESH performance in real-time
const meshMetrics = {
latency: {
p50: 3.2, // milliseconds
p95: 8.7,
p99: 12.1
},
routing: {
activeRegions: 3,
failovers: 0,
protocolTranslations: 150
},
uptime: 99.99
};
// Get detailed routing decisions
const routingDecisions = await wave.mesh.getRoutingHistory({
streamId: 'stream-123',
limit: 100
});Create complex routing rules based on stream characteristics
// Create a custom routing policy
const customPolicy = {
name: 'sports-broadcast',
conditions: [
{
if: 'bitrate > 10mbps',
then: 'route to high-capacity regions',
priority: 1
},
{
if: 'viewerGeo === "asia-pacific"',
then: 'prefer apac regions',
priority: 2
},
{
if: 'regionHealth < 90%',
then: 'failover to backup region',
priority: 3
}
]
};
await wave.mesh.createPolicy(customPolicy);// Monitor MESH health and routing decisions
wave.mesh.on('routing-decision', (event) => {
console.log('Routing decision made:');
console.log(' latency:', event.latencyMs);
console.log(' selected region:', event.region);
console.log(' reason:', event.reason);
});
wave.mesh.on('failover', (event) => {
console.log('Failover occurred:');
console.log(' from:', event.fromRegion);
console.log(' to:', event.toRegion);
console.log(' duration:', event.switchoverMs);
});Latency > 50ms usually indicates a region health issue. Check region status in dashboard or use wave mesh:health.
Ensure source protocol is supported by PIPELINE. Check available protocols in dashboard settings.
Verify failover is enabled and backup regions are healthy. Test with wave mesh:test-failover.
Learn cost-optimized, region-locked, and quality-aware policies
Combine MESH routing with EDGE real-time processing
Track routing metrics and viewer experience in real-time