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.

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.
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.
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.
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.
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.
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 in this deliberately keepalive-heavy model is about 672.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.
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.
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.".
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
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.
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?
Show answer
Answer: D Call setup and encrypted media use different planes.
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)?
Show answer
Answer: A see answers page
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?
Show answer
Answer: B Jason argues that a connectionless exchange lets the radio sleep between scheduled reports, extending battery life.
Print reference
Answers
Answer key.
- D · Call setup and encrypted media use different planes.
- 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.
- B · Jason argues that a connectionless exchange lets the radio sleep between scheduled reports, extending battery life.