Client queues outbound messages while offline and re-sends on reconnect
Why it matters
A user who types a message while their phone switches from WiFi to cellular loses the message silently — the send fires against a disconnected socket and the error is swallowed. No error message, no retry prompt, no indication the message was lost. This erodes trust in the platform's basic promise of delivery. ISO 25010 reliability covers graceful degradation under transient connectivity loss, and offline-aware apps are now a baseline expectation for communication tools.
Severity rationale
Low because silently dropped outbound messages occur only during transient disconnects, but they produce irreversible data loss with no user-visible signal.
Remediation
Buffer outbound messages in a client-side queue and flush automatically on reconnect. Persist the queue to localStorage if you need durability across page reloads.
class OutboundQueue {
private q: Array<{ id: string; data: unknown }> = [];
private connected = false;
constructor(private socket: Socket) {
socket.on('connect', () => { this.connected = true; this.flush(); });
socket.on('disconnect', () => { this.connected = false; });
}
send(data: unknown) {
const id = nanoid();
if (this.connected) {
this.socket.emit('send_message', { ...data as object, id });
} else {
this.q.push({ id, data });
}
}
private flush() {
while (this.q.length) {
const item = this.q.shift()!;
this.socket.emit('send_message', { ...item.data as object, id: item.id });
}
}
}
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Real-Time Communication Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · reliability.recoverability — Recoverability
Taxons
History
- 2026-04-18·v1.0.0·Initial import from community-realtime·automated