You're waiting for a long AI response. It's streaming, word by word. You accidentally refresh the page. Gone. You switch tabs on your phone for two seconds. Gone. You close the browser and reopen it. Gone.
This is one of the most frustrating things about AI apps right now, and most developers don't even know it's fixable.
In this video I show you how to implement resumable streams so your AI responses survive page refreshes, tab switches, and dropped connections. We're using Next.js, the Vercel AI SDK, the resumable-stream package, and Redis as a pub/sub backend. We cover the full architecture — parallel token streaming to both the client and Redis, the publisher/subscriber pattern, consumeSseStream, createResumableStreamContext, prepareReconnectToStreamRequest, and the GET handler that picks up exactly where the stream left off.
Links
→ AI SDK Resumable Streams docs: https://ai-sdk.dev/docs/ai-sdk-ui/cha...
→ resumable-stream package: https://github.com/vercel/resumable-s...
→ work with me: https://www.dawnstudio.co/
Timestamps
0:00 The problem nobody talks about
0:23 What we're actually building
1:32 The architecture behind the magic
2:50 The one field your DB is missing
3:19 Where the stream splits in two
6:01 Wiring up the client side
7:07 The reconnection endpoint
8:22 The detail most people skip