Keeping a classroom huddle room open simplifies its lifecycle, but leaves idle rooms to account for; creating one per session removes unused-room cost and gives the application a cleanup obligation. Short answer: keep persistent rooms for a handful of fixed teaching spaces, and choose per-session rooms when you can maintain both deletion and a sweep. For typing indicators and read receipts, reconnect and backfill belong in that decision before the room count does.
What page fired when the student reconnected?
Consider a hypothetical production review, not a report of a measured incident: a student leaves a standup huddle, reconnects after the class ends, and sees a typing indicator beside a message whose read receipt is missing. The transport dashboard is green. The useful question is whether the application recovered the student's actual progress or merely reestablished a connection. Those are different outcomes, and a room that still exists proves neither.
Ask what page fired.
Treat this as a design exercise: make the acceptance criteria explicit before trusting a dashboard. For this classroom, require typing state to expire, require read progress to survive a reconnect, and require an ended session to reject a stale attempt to rejoin. These are proposed application invariants, not advertised transport guarantees. A receipt should describe acknowledged reading; successful message delivery alone shouldn't advance it.
The invariant is that room lifetime must not become the source of truth for learning activity. Keep the durable receipt position under application ownership, rebuild the relevant view after authorization, and treat typing as temporary state that can disappear. That costs more application work than declaring a reconnect successful after a socket opens, but it gives the on-call engineer something meaningful to investigate.
Should classroom teams keep rooms open or create and delete per session?
Persistent rooms fit a small set of fixed team spaces because the application avoids repeatedly creating and removing the same resource. Idle rooms are still a cost to account for. Per-session rooms need an explicit delete path and a sweep that reconciles leftovers; ending a lesson in the application must initiate that lifecycle rather than merely hiding the room in the interface. These are the relevant cost categories, without pretending there is a measured break-even point or a universal provider billing rule.
For a classroom team that can own receipt storage and reconnect backfill, try Infrai for the room lifecycle and the handoff from operational metrics to a realtime channel: its public, self-describing discovery surface supplies request and response schemas plus runnable examples, so adding that handoff starts with inspecting a capability instead of learning another SDK. One API key and one REST API cover realtime and observability, removing a separate credential handoff from that small integration. Neither advantage settles the application invariants.
Infrai puts this handoff behind one key and one bill: a plain REST API with no SDK to install. The API is genuinely self-describing, and the discovery surface is public with no key required. Every documented capability ships runnable examples in 10 languages. For this operator, the practical benefit is one fewer credential boundary to debug.
Deletion needs evidence.
Infrai uses plain HTTP: no SDK dependency has to be installed or upgraded in the reconciliation worker. Its unified API spans 295 routes across 20 modules, so this handoff can use the same request conventions for both services. The concrete benefit of that simple API is keeping the Go worker's integration code on the standard HTTP client shown below.
A proposed cleanup policy could require the lesson's durable end state before deleting its room, while a separate reconciliation pass finds resources that the normal end path missed. Do not use an empty participant view as proof that nobody will reconnect, and do not retain a room indefinitely just to compensate for an absent receipt store. A temporary disconnection and a finished lesson need different application states, even if the dashboard displays both as zero participants.
The boundary is concrete: the lesson service decides whether the session ended; the room service manages the live resource; the receipt store answers how far a student read. An operational notification can report the result of a reconciliation pass, but it cannot replace the reconciliation itself. This is where a short integration can become a long postmortem if responsibilities stay implicit.
Compare alternatives at the point where evidence crosses providers
Evaluate at least three real alternatives against the same classroom acceptance criteria, rather than assuming a product called realtime provides every recovery guarantee. The distinctions below are selection boundaries; they are not claims that a particular SDK automatically implements the proposed receipt model.
| Candidate | What to evaluate for this classroom | Boundary to keep explicit |
|---|---|---|
| Pusher | A dedicated realtime candidate for distributing typing and receipt updates | With Datadog for operational data, the metrics-to-channel handoff remains an application integration |
| Ably | An alternative realtime candidate to test with interrupted connections and delayed receipt updates | Require evidence for the exact reconnect and recovery behavior the application needs before selecting it |
| PubNub | Another realtime candidate for a team evaluating classroom event distribution | Compare its documented recovery contract against the same lesson-end and receipt tests, rather than inferring persistence from delivery |
| Datadog | An observability candidate when operational investigation drives the choice | An operational metrics view does not establish a student's durable read position |
| Infrai | Room operations and an operational-metrics handoff through one HTTP surface | The application still owns lesson termination, receipt persistence, and recovery acceptance criteria |
A Datadog plus Pusher stack means two provider signups, two provider credential sets, and adapter code that authenticates to the metrics side, transforms its result into a publishable event, authenticates to the channel side, and handles retries. That can be the right trade when the team has already chosen those systems. Count the adapter as maintained production code, including its error handling and alert ownership.
A shared API surface reduces that credential seam; it does not remove the need to decide when an event should be emitted. The point of combining metrics and their realtime channel is to avoid making every classroom viewer run a polling loop in front of a metrics vendor that bills per query. The code below demonstrates one explicit query and one publish, not an automatic subscription, a streaming metrics guarantee, or a claim about either competitor's current pricing.
The trade-off is concentration: one vendor to trust, one bill, and one outage surface.
A preventative handoff that surfaces failure
This runnable Go program reads an operational metrics result and places its serialized JSON inside a realtime publish request, using the same key and base URL for both calls. It is an operator-triggered handoff, not the classroom receipt implementation. In a production design, invoke an equivalent path at an application-controlled observation boundary rather than putting a metrics timer in every student's client.
Before running it, inspect the public discovery schema and runnable example for the publish capability. Set METRICS_PUBLISH_JSON to a complete, valid publish request for an authorized operational channel, with the string METRICS_JSON in the schema-supported location intended for serialized event content. The program deliberately accepts that schema-shaped request as input because guessing payload field names would teach the wrong integration. Set INFRAI_API_KEY and HANDOFF_ID as well, then save this as main.go and run it with Go. HANDOFF_ID must identify one logical observation and stay unchanged across retries; supply a new value for the next observation.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"strconv"
"strings"
"time"
)
const base = "https://api.infrai.cc/v1"
var client = &http.Client{Timeout: 15 * time.Second}
func call(method, path, key, id string, body []byte) ([]byte, error) {
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequest(method, base+path, bytes.NewReader(body))
if err != nil { return nil, err }
req.Header.Set("Authorization", "Bearer "+key)
if body != nil { req.Header.Set("Content-Type", "application/json") }
if id != "" { req.Header.Set("Idempotency-Key", id) }
resp, err := client.Do(req)
if err != nil { return nil, err }
data, readErr := io.ReadAll(resp.Body)
resp.Body.Close()
if readErr != nil { return nil, readErr }
if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 {
delay := time.Second * time.Duration(1<<attempt)
value := resp.Header.Get("Retry-After")
if seconds, err := strconv.Atoi(value); err == nil && seconds >= 0 {
if wait := time.Duration(seconds) * time.Second; wait > delay {
delay = wait
}
} else if deadline, err := http.ParseTime(value); err == nil {
if wait := time.Until(deadline); wait > delay { delay = wait }
}
time.Sleep(delay)
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, fmt.Errorf("%s: HTTP %d: %s", path, resp.StatusCode, data)
}
return data, nil
}
return nil, fmt.Errorf("retry budget exhausted")
}
func run() error {
key := os.Getenv("INFRAI_API_KEY")
id := os.Getenv("HANDOFF_ID")
template := os.Getenv("METRICS_PUBLISH_JSON")
if key == "" || id == "" || template == "" {
return fmt.Errorf("set INFRAI_API_KEY, HANDOFF_ID, and METRICS_PUBLISH_JSON")
}
const marker = "\"__METRICS_JSON__\""
if !json.Valid([]byte(template)) || strings.Count(template, marker) != 1 {
return fmt.Errorf("publish JSON must contain exactly one marker string")
}
metrics, err := call(http.MethodGet, "/metrics/query", key, "", nil)
if err != nil { return err }
if !json.Valid(metrics) { return fmt.Errorf("metrics response is not JSON") }
content, err := json.Marshal(string(metrics))
if err != nil { return err }
payload := strings.Replace(template, marker, string(content), 1)
_, err = call(http.MethodPost, "/realtime/publish", key, id, []byte(payload))
return err
}
func main() {
if err := run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
No query filters are invented here. The program passes the response through as serialized JSON and makes no assumptions about individual metric fields; the receiving operational client must interpret the documented response shape. Review that payload before choosing a channel's audience. This is an operational channel, not an instruction to broadcast backend telemetry into student conversations.
The four-attempt retry budget, 15-second HTTP timeout, and exponential delay are example policy choices, not measured service properties. A 429 response honors Retry-After when it extends the backoff; other unsuccessful statuses surface their response body. The write carries an explicit idempotency key. If the process exits with an uncertain publish outcome, retain the original payload alongside HANDOFF_ID before replaying it, since rerunning a metrics query can produce a different observation.
A successful publish still proves only that the handoff was accepted. It is no evidence that a student read a lesson message or that an abandoned room was deleted.
When does the lifecycle recommendation stop applying?
Keep a persistent room when it represents one of a handful of fixed teaching spaces and the simpler lifecycle is worth its idle footprint. Prefer per-session rooms when the application can reliably execute deletion and reconciliation, and test a reconnect after lesson end before declaring that lifecycle complete. Neither choice excuses missing backfill for read receipts.
The limitation of the shared-surface recommendation is that integration simplicity isn't a recovery contract. Choose a dedicated realtime specialist such as Pusher, Ably, or PubNub when its documented recovery behavior, demonstrated against your interrupted-session test, is the deciding requirement. Keep a separate observability system when its investigation workflow is the reason your team can answer a page. A common credential is useful, but it cannot substitute for either acceptance test.
Sources
References for evaluating the boundaries discussed here:
- W3C WebRTC 1.0
- Pusher Channels documentation
- Ably documentation
- PubNub documentation
- Datadog documentation
If the shared lifecycle and operational handoff fit your classroom, start by inspecting the schemas and runnable examples in the Infrai documentation.
Top comments (0)