viewof deviceRam = Inputs.radio(
["< 16 KB", "16-32 KB", "32-128 KB", "> 128 KB"],
{value: "32-128 KB", label: "Device RAM available"}
)
viewof networkType = Inputs.radio(
["Stable (Wi-Fi/Ethernet)", "Mobile/Cellular", "Lossy wireless", "Enterprise (UDP blocked)"],
{value: "Stable (Wi-Fi/Ethernet)", label: "Network environment"}
)
viewof useCase = Inputs.radio(
["Simple sensor readings", "Gateway aggregation", "Real-time + bulk data", "Infrequent transmissions"],
{value: "Gateway aggregation", label: "Primary use case"}
)
viewof httpInfrastructure = Inputs.radio(
["Yes - must use HTTP", "No - can use any protocol"],
{value: "Yes - must use HTTP", label: "Existing HTTP infrastructure"}
)
// Decision logic
recommendedProtocol = (() => {
// Constrained devices
if (deviceRam === "< 16 KB") {
return {
protocol: "CoAP or MQTT-SN",
reason: "Device RAM is too limited for a TLS + HTTP stack (typically needs 32 KB+)",
color: "#9B59B6"
};
}
if (deviceRam === "16-32 KB" && useCase === "Simple sensor readings") {
return {
protocol: "MQTT or CoAP",
reason: "Lightweight protocols better suited for constrained devices with simple messaging",
color: "#9B59B6"
};
}
// HTTP infrastructure requirement
if (httpInfrastructure === "No - can use any protocol") {
if (useCase === "Simple sensor readings" || useCase === "Infrequent transmissions") {
return {
protocol: "MQTT or CoAP",
reason: "Simpler protocols more efficient for basic sensor scenarios without HTTP requirement",
color: "#9B59B6"
};
}
}
// UDP blocked
if (networkType === "Enterprise (UDP blocked)") {
if (deviceRam === "32-128 KB" || deviceRam === "> 128 KB") {
return {
protocol: "HTTP/2",
reason: "UDP blocked rules out HTTP/3; HTTP/2 provides multiplexing benefits over TCP",
color: "#16A085"
};
}
}
// Mobile/Cellular scenarios
if (networkType === "Mobile/Cellular") {
if (deviceRam === "> 128 KB") {
return {
protocol: "HTTP/3",
reason: "QUIC's 0-RTT resumption and connection migration ideal for mobile IoT",
color: "#3498DB"
};
} else if (deviceRam === "32-128 KB") {
return {
protocol: "HTTP/2",
reason: "HTTP/3 would be ideal but RAM constraint limits to HTTP/2",
color: "#16A085"
};
}
}
// Lossy wireless
if (networkType === "Lossy wireless") {
if (deviceRam === "> 128 KB") {
return {
protocol: "HTTP/3",
reason: "QUIC's independent streams eliminate head-of-line blocking on lossy links",
color: "#3498DB"
};
} else if (deviceRam === "32-128 KB") {
return {
protocol: "HTTP/2",
reason: "HTTP/2 multiplexing helps, but beware TCP head-of-line blocking on lossy links",
color: "#E67E22"
};
}
}
// Gateway aggregation
if (useCase === "Gateway aggregation") {
if (deviceRam === "> 128 KB") {
return {
protocol: "HTTP/2 or HTTP/3",
reason: "Both work well; HTTP/2 for stable networks, HTTP/3 if mobile connectivity",
color: "#16A085"
};
} else if (deviceRam === "32-128 KB") {
return {
protocol: "HTTP/2",
reason: "Multiplexing perfect for gateway scenarios; single connection for many sensors",
color: "#16A085"
};
}
}
// Real-time + bulk data
if (useCase === "Real-time + bulk data") {
if (deviceRam === "> 128 KB") {
return {
protocol: "HTTP/3",
reason: "Independent streams prevent bulk transfers from blocking real-time telemetry",
color: "#3498DB"
};
} else if (deviceRam === "32-128 KB") {
return {
protocol: "HTTP/2",
reason: "HTTP/2 works but note TCP head-of-line blocking may affect mixed priority streams",
color: "#E67E22"
};
}
}
// Default stable network
if (deviceRam === "32-128 KB" || deviceRam === "> 128 KB") {
return {
protocol: "HTTP/2",
reason: "Solid choice for stable networks with sufficient resources",
color: "#16A085"
};
}
// Fallback
return {
protocol: "MQTT or CoAP",
reason: "Default lightweight protocol for constrained IoT scenarios",
color: "#9B59B6"
};
})()
html`<div style="background: #f8f9fa; padding: 20px; border-radius: 8px; border-left: 4px solid ${recommendedProtocol.color}; margin-top: 15px;">
<p style="color: #2C3E50; margin-top: 0; font-weight: 700;">Recommendation</p>
<div style="background: white; padding: 20px; border-radius: 6px; border: 2px solid ${recommendedProtocol.color}; margin-top: 15px;">
<div style="font-size: 0.85em; color: #7F8C8D; text-transform: uppercase; margin-bottom: 5px;">RECOMMENDED PROTOCOL</div>
<div style="font-size: 2em; font-weight: bold; color: ${recommendedProtocol.color}; margin-bottom: 10px;">
${recommendedProtocol.protocol}
</div>
<div style="font-size: 1em; color: #2C3E50; line-height: 1.6;">
${recommendedProtocol.reason}
</div>
</div>
<div style="margin-top: 20px; padding: 15px; background: white; border-radius: 6px; border: 1px solid #dee2e6;">
<div style="color: #7F8C8D; font-size: 0.85em; margin-bottom: 10px;">YOUR CONFIGURATION</div>
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; font-size: 0.9em;">
<div><strong>RAM:</strong> ${deviceRam}</div>
<div><strong>Network:</strong> ${networkType}</div>
<div><strong>Use Case:</strong> ${useCase}</div>
<div><strong>HTTP Required:</strong> ${httpInfrastructure}</div>
</div>
</div>
<div style="margin-top: 15px; padding: 12px; background: #e8f5f2; border-radius: 6px; font-size: 0.85em; color: #2C3E50;">
<strong>Tip:</strong> Try adjusting the parameters above to see how different constraints affect protocol selection. The flowchart in the Protocol Selection Guide section above provides the full decision tree logic.
</div>
</div>`Interactive Tool: Protocol Selection Advisor
Interactive Tool: Protocol Selection Advisor
animation
http
protocols
Try Change Network environment while keeping the other deployment parameters fixed. Then press Check protocol selection.
Observe After pressing Check protocol selection, watch the recommended protocol and reason as Network environment changes.
Explain Describe how Device RAM available affects protocol selection after you press Check protocol selection.
Technical boundaries. The recommendation uses a decision tree based on RAM, network environment, use case and HTTP infrastructure. Constrained device rules are checked before HTTP infrastructure requirements.