Hotwire Demo

A Rails chat that updates with Turbo Streams.

Submit a message and Rails broadcasts HTML over Action Cable. Every browser subscribed to this room receives the new message without a full-page reload.

Live Room

Hotwire Support

WebSocket on
No messages yet. Open this page in two browsers and send the first one.

POST -> model broadcast -> WebSocket

1. Form submits

The Rails form creates a `ChatMessage` with Turbo enabled by default.

2. Model broadcasts

`ChatMessage` broadcasts a Turbo Stream to `hotwire_chat_messages` after commit.

3. Browsers patch DOM

Every subscribed browser appends the message into `chat_messages` over WebSocket.