Application Protocols · Study deck
Realtime Protocols: Transport Selection
Realtime protocols matter when "check again later" is not good enough.
Broker Bex is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Explain: Math: Using the same assumptions from the calculator above, MQTT publish traffic is about 54.9 MB/month, and a 60-second keepalive adds roughly 618.0 MB/month more.
- Explain: A good design separates protocol roles, sets timing and quality expectations, protects signaling and media, and keeps evidence that the path works under delay, loss, fallback, and disconnect conditions.
- Explain: Close idle or unauthenticated sockets before they become a fleet-wide resource drain, and rate-limit reconnects because persistent channels often fail together after server restarts.
- Explain: MQTT means a topic-based publish-and-listen method.
Major section
Deep Dive: How "Live" Rides On (and Escapes) HTTP
A WebSocket connection is born as a normal HTTP/1.1 request.
- Live IoT views need a channel that stays open so state or media can arrive when it changes.
- A dashboard status feed can stay on SSE and reuse ordinary HTTP infrastructure.
- Sec-WebSocket-Accept is not random.
Major section
Deep Dive: How "Live" Rides On (and Escapes) HTTP (continued)
A door-lock console that sends commands while receiving state needs WebSocket and explicit authorization for each command frame.
- If the server agrees, it does not return 200 OK.
- The client checks this value so a cache or proxy cannot fake the upgrade by echoing headers.
- WebRTC is where real-time media stops looking like HTTP.
Major section
Deep Dive: How "Live" Rides On (and Escapes) HTTP (continued)
Close idle or unauthenticated sockets before they become a fleet-wide resource drain, and rate-limit reconnects because persistent channels often fail together after server restarts.
- It splits into a signaling plane that sets the call up and a media plane that carries the encrypted stream.
- WebRTC deliberately does not standardize signaling; you can carry SDP offer/answer over WebSocket, SIP, or another application channel.
- For every realtime path, keep three records together: the signaling protocol, the media or event transport, and the fallback path.
Major section
Debate: MQTT vs. CoAP Protocol Selection
Debate One Failure, Not Two Brand Names: Picture a battery sensor that sends routine readings but must also accept a rare setting change.
- The best exchange pattern depends on who starts each action, what state is kept, and what a retry can repeat.
- CoAP means a compact request-and-response method.
- Persistent connection allows instant alerts.
Major section
Debate: MQTT vs. CoAP Protocol Selection (continued)
MQTT means a topic-based publish-and-listen method.
- Quality of service means a selected delivery level; QoS is its short name.
- UDP means independent datagrams with no built-in delivery promise.
- A small byte count or live connection does not prove the system choice.
- This runway does not name a universal winner.
Major section
Debate: MQTT vs. CoAP Protocol Selection (continued)
Sensors send readings every 15 minutes.
- Cellular connectivity is available but expensive.
- Total MQTT traffic is about $672.9$ MB/month.
- At $0.10$/MB cellular pricing, that is roughly $\$67.29$ vs $\$2.75$ for CoAP-style telemetry, which is a meaningful design trade-off.
- Constraint: Cellular data costs $0.10/MB.
Major section
Debate: MQTT vs. CoAP Protocol Selection (continued)
Math: Using the same assumptions from the calculator above, MQTT publish traffic is about 54.9 MB/month, and a 60-second keepalive adds roughly 618.0 MB/month more.
- Confirmable messages provide reliability.
- Smaller request/response exchanges keep routine telemetry lightweight.
- Data is never lost.".
Major section
Debate: MQTT vs. CoAP Protocol Selection (continued)
QoS 1 ensures 95% delivery with ACKs.
- Math: 500 sensors × 96 msg/day × 20 bytes × 30 days is about 27.5 MB/month, or $2.75/month at $0.10/MB.
- [15-20 min] Cross-Examination (Facilitator moderates): Q: "Maria, what happens when cellular drops during 15-min sleep?" A: "MQTT broker stores messages.
- Student Feedback: "Switching sides forced me to see why someone would choose the other protocol.
Major section
Summary
A good design separates protocol roles, sets timing and quality expectations, protects signaling and media, and keeps evidence that the path works under delay, loss, fallback, and disconnect conditions.
- Realtime application protocols are useful when IoT systems need live media, current state, or interactive operation.
- RTP carries timed media and RTCP reports quality.
- SIP sets up sessions.
- SRTP protects media.
Deck summary
Key takeaways
A WebSocket connection is born as a normal HTTP/1.1 request.
- A door-lock console that sends commands while receiving state needs WebSocket and explicit authorization for each command frame.
- Close idle or unauthenticated sockets before they become a fleet-wide resource drain, and rate-limit reconnects because persistent channels often fail together after server restarts.
- Debate One Failure, Not Two Brand Names: Picture a battery sensor that sends routine readings but must also accept a rare setting change.
- MQTT means a topic-based publish-and-listen method.
Retrieval practice
Recall check 1 of 2

Broker Bex says: answer from memory, then check your reasoning.
Q1For the chapter's worked example (500 sensors, 15-minute reporting interval, 30 days), roughly how does CoAP's monthly cellular data compare to MQTT's (including keepalive)?
Show answer
Answer: A The chapter's worked numbers: 500 sensors x 96 messages/day = 48,000 messages/day.
Retrieval practice
Recall check 2 of 2

Broker Bex says: answer from memory, then check your reasoning.
Q2In the chapter's roleplay script, what does Jason (arguing for CoAP) say is the battery-life benefit of CoAP's connectionless design in this scenario?
Show answer
Answer: A
Print reference
Answers
Answer key.
- A · The chapter's worked numbers: 500 sensors x 96 messages/day = 48,000 messages/day.
- A