Bolt realtime

Chat Messages Not Updating in Real-Time in Bolt App

Your Bolt.new chat feature saves messages to the database correctly, but other participants don't see new messages until they manually refresh the page. The chat feels like an email inbox rather than a live conversation, making real-time communication impossible.

Users expect chat to be instant - messages should appear within milliseconds of being sent. When they have to refresh the page to see responses, they assume the feature is broken and will abandon it for a working alternative. This is a fundamental functionality issue that undermines the entire purpose of a chat feature.

The root cause is that Bolt generated a working CRUD interface for messages (create, read, update, delete) but didn't implement the real-time subscription layer that pushes new messages to connected clients as they arrive.

Error Messages You Might See

Realtime connection failed: WebSocket error Supabase Realtime: Table not enabled for replication Channel already joined Error: Maximum number of Realtime channels exceeded WebSocket connection to 'wss://...' failed
Realtime connection failed: WebSocket errorSupabase Realtime: Table not enabled for replicationChannel already joinedError: Maximum number of Realtime channels exceededWebSocket connection to 'wss://...' failed

Common Causes

  • No real-time subscription — Messages are fetched on page load but there's no WebSocket or Supabase Realtime subscription to receive new messages
  • Supabase Realtime not enabled — The Realtime feature is not turned on for the messages table in the Supabase dashboard
  • Subscription filter too broad or narrow — The Realtime subscription listens to the wrong table, wrong event type, or wrong filter condition
  • New messages not added to local state — The subscription receives events but the callback doesn't append the new message to the displayed list
  • Channel not subscribed — The channel is created but .subscribe() was never called, so no events are received
  • Cleanup function missing — Previous subscriptions aren't cleaned up on component unmount, causing duplicate messages or memory leaks

How to Fix It

  1. Enable Realtime on your table — In Supabase dashboard, go to Database > Replication and enable Realtime for your messages table
  2. Add a Realtime subscription — Subscribe to new messages: useEffect(() => { const channel = supabase.channel('messages').on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'messages', filter: `chat_id=eq.${chatId}` }, (payload) => { setMessages(prev => [...prev, payload.new]); }).subscribe(); return () => { supabase.removeChannel(channel); }; }, [chatId])
  3. Handle all event types — Subscribe to INSERT, UPDATE, and DELETE events to handle new messages, edits, and deletions
  4. Auto-scroll to new messages — After adding a new message to state, scroll the chat container to the bottom: messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' })
  5. Add optimistic updates — Show sent messages immediately in the UI before the database confirms, then reconcile when the Realtime event arrives
  6. Clean up subscriptions — Always remove channels in the useEffect cleanup function to prevent memory leaks and duplicate messages

Real developers can help you.

Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) Daniel Vázquez Daniel Vázquez Software Engineer with over 10 years of experience on Startups, Government, big tech industry & consulting. Mehdi Ben Haddou Mehdi Ben Haddou - Founder of Chessigma (1M+ users) & many small projects - ex Founding Engineer @Uplane (YC F25) - ex Software Engineer @Amazon and @Booking.com Matthew Jordan Matthew Jordan I've been working at a large software company named Kainos for 2 years, and mainly specialise in Platform Engineering. I regularly enjoy working on software products outside of work, and I'm a huge fan of game development using Unity. I personally enjoy Python & C# in my spare time, but I also specialise in multiple different platform-related technologies from my day job. MFox MFox Full-stack professional senior engineer (15+years). Extensive experience in software development, qa, and IP networking. Caio Rodrigues Caio Rodrigues I'm a full-stack developer focused on building practical and scalable web applications. My main experience is with **React, TypeScript, and modern frontend architectures**, where I prioritize clean code, component reusability, and maintainable project structures. I have strong experience working with **dynamic forms, state management (Redux / React Hook Form), and complex data-driven interfaces**. I enjoy solving real-world problems by turning ideas into reliable software that companies can actually use in their daily operations. Beyond coding, I care about **software quality and architecture**, following best practices for componentization, code organization, and performance optimization. I'm also comfortable working across the stack when needed, integrating APIs, handling business logic, and helping transform prototypes into production-ready systems. My goal is always to deliver solutions that are **simple, efficient, and genuinely useful for the people using them.** Antriksh Narang Antriksh Narang 5 years+ Experienced Dev (Specially in Web Development), can help in python, javascript, react, next.js and full stack web dev technologies. Kingsley Omage Kingsley Omage Fullstack software engineer passionate about AI Agents, blockchain, LLMs. Victor Denisov Victor Denisov Developer Basel Issmail Basel Issmail ’m a Senior Full-Stack Developer and Tech Lead with experience designing and building scalable web platforms. I work across the full development lifecycle, from translating business requirements into technical architecture to delivering reliable production systems. My work focuses on modern web technologies, including TypeScript, Angular, Node.js, and cloud-based architectures. I enjoy solving complex technical problems and helping teams turn product ideas and prototypes into working platforms that can grow and scale. In addition to development, I often collaborate closely with product managers, business analysts, designers, and QA teams to ensure that solutions align with both technical and business goals. I enjoy working with startups and product teams where I can contribute both as a hands-on engineer and as a technical partner in designing and delivering impactful software.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

How do I enable Supabase Realtime for my messages table?

Go to Supabase dashboard > Database > Replication. Toggle on the messages table. Then in your code, subscribe to postgres_changes events on that table. Note that Realtime must be enabled per-table, it's not on by default.

Why do I see duplicate messages with Realtime?

This usually happens when the subscription callback adds the message but you also add it when sending. Either use optimistic updates (add on send, reconcile on subscription) or only add messages through the subscription callback. Also ensure you clean up subscriptions in useEffect cleanup to prevent duplicate listeners.

Related Bolt Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help