A 311 streaming UI must show Claude tokens as they arrive for resident chat. Which client pattern fits?
Select an answer to reveal the explanation.
Short Explanation
Residents hate blank spinners—stream Claude tokens over SSE or websockets so chat feels alive. Polling for snapshots, waiting for the stop reason, or replaying a cached reply all leave them staring at nothing while Claude works.
Full Explanation
A 311 streaming UI should consume SSE-style or websocket streams from the Claude client wrapper so resident chat shows tokens as they arrive. Progressive delivery improves perceived latency, reduces abandoned sessions, and lets residents interrupt or clarify mid-response instead of staring at a blank spinner during long generations.
Polling the Messages endpoint on an interval to refresh resident chat snapshots fails because chat is interactive—residents need tokens as they arrive for service requests, not delayed snapshot refreshes. Accumulating stream deltas locally and rendering only on stop reason fails conceptually: the resident sees no partial feedback while Claude works, and the UI effectively freezes until the stream ends. Subscribing to message_start events and replaying cached completions fails as a UX regression that shows cached replies instead of live tokens, hiding whether Claude is still making progress.
Exam caveat: streamed civic answers still need final validation—PII filters, policy checks, and completion markers—before the message is marked complete and auditable. Operational check: exercise the streaming client against Claude, confirm partial tokens render safely, and verify the completed message matches the assembled stream plus any post-filters applied at end-of-stream.