Application Protocols · Study deck

Realtime Protocols: Transport Selection

A realtime protocol is a set of rules for messages that must arrive soon enough for the job.

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:

  • Trace upgrade, signalling, and media paths around HTTP.
  • Select MQTT, CoAP, WebSocket, or WebRTC from evidence.
  • Explain: Ordinary short HTTP exchanges finish after a response, but HTTP can also keep a response stream open, as SSE does.
  • Explain: WebRTC is where real-time media stops looking like HTTP.
iotclass.org

Major section

Deep Dive: How "Live" Rides On (and Escapes) HTTP

Ordinary short HTTP exchanges finish after a response, but HTTP can also keep a response stream open, as SSE does.

  • Live IoT views need an update path so state or media can arrive when it changes.
  • A dashboard status feed can stay on SSE and reuse ordinary HTTP infrastructure.
  • A door-lock console that sends commands while receiving state needs WebSocket and explicit authorization for each command frame.

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)

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

  • If the server agrees, it does not return 200 OK.
  • Sec-WebSocket-Accept is not random.
  • It splits into a signaling plane that sets the call up and a media plane that carries the encrypted stream.
iotclass.org

Major section

Deep Dive: How "Live" Rides On (and Escapes) HTTP (continued)

The client checks that the peer performed the WebSocket handshake rather than merely echoing the key; this SHA-1 value is not authentication or encryption.

  • After the HTTP/1.1 upgrade, that connection carries WebSocket frames rather than further HTTP messages, with a small header plus payload in either direction.
  • 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.
  • WebRTC deliberately does not standardize signaling; you can carry SDP offer/answer over WebSocket, SIP, or another application channel.
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.
  • Confirmable messages provide reliability.

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

Persistent connection allows instant alerts.

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 in this deliberately keepalive-heavy model is about 672.9672.9672.9 MiB/month.
  • At an illustrative $0.10/MiB, that is about $67.29 versus $2.75 for the CoAP model.
  • Constraint: Cellular data costs $0.10/MB.
iotclass.org

Major section

Debate: MQTT vs. CoAP Protocol Selection (continued)

Smaller request/response exchanges keep routine telemetry lightweight.

  • Actual billed traffic includes lower-layer framing, security, and carrier policy.
  • [0-5 min] Context Setting (Facilitator): Use the same sensor count, message size, rate, price, and target in both cases.
  • Student Feedback: "Switching sides forced me to see why someone would choose the other protocol.
iotclass.org

Major section

Debate: MQTT vs. CoAP Protocol Selection (continued)

Persistent connection allows instant alerts.

  • Team A (MQTT): Maria presents The MQTT case combines delivery behavior and broker fan-out with the traffic estimate; test whether the full path reaches the stated target.
  • QoS 1 supports at-least-once transfer between client and broker; test whether the full path meets the 95% target.
  • The device must retry unconfirmed sends and make duplicates safe; no configuration makes data loss impossible.".
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

Ordinary short HTTP exchanges finish after a response, but HTTP can also keep a response stream open, as SSE does.

  • WebRTC is where real-time media stops looking like HTTP.
  • The client checks that the peer performed the WebSocket handshake rather than merely echoing the key; this SHA-1 value is not authentication or encryption.
  • 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 3

Broker Bex says: answer from memory, then check your reasoning.

Q1A browser starts a live intercom call. Which trace keeps the setup path distinct from the media path?

ATreat an HTTP upgrade as proof that media reached the remote peer
BRecord the web page URL alone as both setup and media evidence
CUse a sensor telemetry topic as the live media transport trace
DRecord signaling messages and the resulting media route separately
Show answer

Answer: D Call setup and encrypted media use different planes.

iotclass.org

Retrieval practice

Recall check 2 of 3

Broker Bex says: answer from memory, then check your reasoning.

Q2For 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 MiB monthly; MQTT uses 672.9 MiB with keepalive, roughly 24 times as much.
BCoAP and MQTT use nearly equal monthly data because each reading carries the same small payload.
CMQTT uses less monthly data than CoAP because its persistent connection removes all keepalive cost.
DCoAP uses more monthly data than MQTT because its UDP headers exceed TCP headers for each reading.
Show answer

Answer: A see answers page

iotclass.org

Retrieval practice

Recall check 3 of 3

Broker Bex says: answer from memory, then check your reasoning.

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

ACoAP eliminates battery use through energy harvesting rather than reduced radio-on time between reports.
BCoAP lets the radio sleep between connectionless reports instead of maintaining an open connection.
CCoAP batches all scheduled readings into one daily send, changing the 15-minute reporting interval.
DCoAP requires a smaller radio antenna than MQTT, so the hardware itself saves battery energy.
Show answer

Answer: B Jason argues that a connectionless exchange lets the radio sleep between scheduled reports, extending battery life.

iotclass.org

Print reference

Answers

Answer key.

  1. D · Call setup and encrypted media use different planes.
  2. A · With the stated application-byte assumptions, CoAP is 27.47 MiB/month and MQTT is 54.93 + 617.98 = 672.91 MiB/month. The 30-byte idle keepalive every minute is an illustrative workload choice, not a universal MQTT cost. At an assumed $0.10/MiB, costs round to $2.75 and $67.29.
  3. B · Jason argues that a connectionless exchange lets the radio sleep between scheduled reports, extending battery life.
iotclass.org