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.

realtimeprotocoldebate
Broker Bex, the module guide, in a scene from this chapter.
iotclass.org

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.
iotclass.org

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.

Key terms

WebRTC
WebRTC is where real-time media stops looking like HTTP.

Why it matters

A camera call needs WebRTC because codecs, media timing, NAT traversal, and congestion control are the real requirements.

iotclass.org

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.
iotclass.org

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.
iotclass.org

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.

Key terms

MQTT
MQTT means a topic-based publish-and-listen method.
Quality of service
Quality of service means a selected delivery level; QoS is its short name.

Why it matters

QoS 1 ensures 95% delivery with ACKs.

iotclass.org

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.
iotclass.org

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.
iotclass.org

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.".
iotclass.org

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.
iotclass.org

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.
iotclass.org

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.
iotclass.org

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)?

ACoAP uses about 27.5 MB/month (~$2.75), while MQTT (publish + keepalive) uses about 672.9 MB/month (~$67.29) -- roughly 24x more, mainly from the once-a-minute keepalive traffic
BCoAP and MQTT use almost the same amount of data, since both send a 20-40 byte payload per reading
CMQTT uses less data because its persistent connection avoids repeated TCP handshakes
DCoAP costs more because UDP requires larger packet headers than TCP
Show answer

Answer: A The chapter's worked numbers: 500 sensors x 96 messages/day = 48,000 messages/day.

iotclass.org

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?

ASleeping between messages instead of holding a connection open saves about 200 mAh/day per sensor, extending battery life by about 6 months
BCoAP eliminates the need for a battery entirely by using energy harvesting
CBatching the scheduled readings into one daily transmission reduces radio wake-ups, and the smaller number of sends produces the battery-life extension Jason describes.
DCoAP's battery savings come from using a smaller radio antenna than MQTT requires
Show answer

Answer: A

iotclass.org

Print reference

Answers

Answer key.

  1. A · The chapter's worked numbers: 500 sensors x 96 messages/day = 48,000 messages/day.
  2. A
iotclass.org