Live props
A prop the server marks as live reloads when its broadcast event arrives: no polling, and only that prop is asked for. In the browser, hand createInertiaApp a Laravel Echo instance (Reverb, Pusher or Ably):
ts
import Echo from 'laravel-echo';
import Pusher from 'pusher-js';
import { createInertiaApp, socketId } from 'inertia-ember';
import { echo } from 'inertia-ember/echo';
const instance = new Echo({
broadcaster: 'reverb',
Pusher,
key: import.meta.env.VITE_REVERB_APP_KEY,
namespace: false,
});
// So the server can leave out the tab that caused the broadcast (`.to_others()`).
socketId.resolveUsing(() => instance.socketId());
createInertiaApp({ live: echo(instance) });echo() also takes a function that returns the instance once it's ready, and Inertia's live options such as throttle.
On the server
With Laravel Rust, .live(...) names the channel and event that refresh a prop. The idea page's idea prop reloads when someone votes:
rust
idea => inertia::lazy(async move || Idea::find(idea_id).await)
.live(inertia::on_channel::<IdeaVoted>(Channel::public(format!("ideas.{idea_id}"))?)),Open the same idea in two tabs and vote in one: the count changes in the other.
Try it ↗