Skip to content
OTFotf
All posts

Real-time event handling in React Native with Laravel Reverb integration

D
DaveAuthor
7 min read
Real-time event handling in React Native with Laravel Reverb integration

Real-time data streams in React Native have always looked easier on paper than they are in code—especially if you're serving a Laravel backend. Laravel Echo and Reverb are a frictionless pair on web, but, until now, connecting mobile clients meant choosing between bending to Pusher’s hosted stack or building a brittle custom WebSocket client. react-native-reverb closes this gap for good: one package, first-party wire protocol compatibility, and event-driven updates across both iOS and Android, straight from your own server. If you need live order tracking, push notifications, or in-app chat without reaching for external, expensive services, this is the approach Laravel devs have been waiting for.

a clean diagram: React Native app ⟷ react-native-reverb ⟷ Laravel Reverb server ⟷ Laravel

What is react-native-reverb and why does it matter?

react-native-reverb is the missing link for React Native developers connecting their mobile apps to a Laravel backend’s real-time events. Out of the box, it turns a React Native app into a first-class citizen on the Laravel Reverb WebSocket server. This means you can subscribe to channels, receive broadcasts (like OrderUpdated), and get native push notifications, all without any DIY protocol hacking.

Laravel Reverb, launched in 2024, is the framework’s official, first-party WebSocket server. It natively supports the Pusher protocol—a key detail, because that’s the lingua franca for most real-time web tooling in Laravel. Unlike hosted Pusher, you’re not tied to a third-party: run Reverb yourself, control costs, keep your data local, and scale as needed.

Previously, you had two underwhelming choices:

  • Pusher’s official React Native SDK: Solid, but tethered to Pusher’s hosted infra. No chance to self-host Reverb without rewriting the client.
  • Custom WebSocket client: Feasible, but every project reinvents protocol support, channel state, and event demuxing. You own all the edge cases.

react-native-reverb hits the sweet spot: a TurboModule (the high-performance modern RN module) with native code for both platforms, matching the Reverb protocol and Laravel ecosystem exactly.

Takeaway: This package lets you enable true, two-way real-time communication on React Native, powered directly from Laravel, with zero vendor lock-in.

How does Laravel Reverb work with React Native?

Laravel Reverb operates as a WebSocket server that implements the Pusher protocol—meaning any client that speaks Pusher can understand it out of the box. On the web, most use Laravel Echo plus the Pusher JS SDK. This pattern enables the backend (Laravel) to broadcast PHP events, and the client (browser) to subscribe to channels and react to those events with minimal boilerplate.

The Pusher protocol revolves around three concepts:

  • Channels: Logical paths for messages, public or private, e.g., orders.123.
  • Events: Named payloads (e.g., OrderUpdated) broadcasted to channels.
  • Authentication: For private channels, the client authenticates with the backend via token or session.

react-native-reverb replicates this dance on mobile. You initialize the module and connect to your Reverb server’s URL. The library manages WebSocket connections natively on both iOS and Android, translates subscription and authentication flows into the exact protocol Laravel Reverb expects, and surfaces all your backend events as Promise-based, composable hooks in JS.

Authentication for private channels is handled automatically, so you don’t have to forward tokens or reimplement route guards in mobile. All channel lifecycle (join, listen, leave) is managed for you, mimicking what you’d expect from Laravel Echo. Event payloads are parsed and exposed right at your callback.

Takeaway: react-native-reverb brings Laravel’s Pusher-protocol broadcasting to React Native with a plug-and-play TurboModule, handling all the hard bits under the hood.

One codebase. iOS, Android, and web.

The Fitness Kit ships with auth, a database, and a backend already connected — no setup. Live demo at fitness-preview.otf-kit.dev.

See the live demo

Step-by-step: setting up react-native-reverb in your React Native app

Start with the package install; setup is simple, but a working Laravel backend with Reverb is required.

npm install react-native-reverb
# or
yarn add react-native-reverb

Configure your Laravel project:

  • Confirm you’re running Laravel Reverb (2024+) as your WebSocket server.
  • In your .env, set:
    BROADCAST_DRIVER=reverb
    REVERB_APP_ID=app-id           # as configured in reverb.php
    REVERB_APP_KEY=app-key
    REVERB_APP_SECRET=app-secret
    REVERB_HOST=127.0.0.1          # or your actual server IP
    REVERB_PORT=6001               # default Reverb port
  • In config/broadcasting.php, ensure the ‘reverb’ connection is active.

Authentication: Laravel Reverb uses the same authentication guard as the rest of your backend. The React Native side will hit your app’s /broadcasting/auth route for private channels.

In your React Native app: Initialize the reverb client:

import Reverb from 'react-native-reverb';

const reverb = new Reverb({
  host: 'ws://your-reverb-server-domain:6001',   // replace with your Reverb instance
  appKey: 'app-key',                             // from your Laravel env
  authEndpoint: '  // required for private channels
  // optional: headers or auth params
});

await reverb.connect();

Subscribe and listen for events:

const channel = await reverb.subscribe('private-orders.123');     // or 'public-orders'
// Listen for 'OrderUpdated' events
channel.listen('OrderUpdated', (data) => {
  // handle update, e.g. update UI state
  console.log('Order updated:', data);
});

Cleanup when done:

await channel.unsubscribe();
await reverb.disconnect();

Troubleshooting tips:

  • Double check the appKey and authentication endpoint align between Laravel and React Native.
  • If using https/wss, ensure SSL certs are valid on both Reverb and your backend.
  • React Native TurboModule errors often mean you need to rebuild native modules.

Takeaway: From npm install to subscribing to real events takes under 15 minutes. All the hard protocol work is abstracted.

Real-world example: live order status tracking with react-native-reverb

Order tracking is where real-time shines—users expect to know instantly when their food leaves the restaurant, the driver is en route, or something goes wrong. react-native-reverb enables this flow with minimal code and solid protocol correctness.

Backend: Laravel event setup First, dispatch order status update events as part of your model logic:

// In OrderController.php or event handler
broadcast(new OrderUpdated($order))->toOthers();

Define OrderUpdated as a Laravel broadcastable event, specifying the broadcasting channel, typically:

public function broadcastOn()
{
    return new PrivateChannel('orders.' . $this->order->id);
}

Now, when an order changes status, the orders.{id} channel receives a real-time update.

Frontend: React Native subscription

const channel = await reverb.subscribe('private-orders.42');

channel.listen('OrderUpdated', (payload) => {
  setOrderStatus(payload.status); // Update UI state in your component
});

Tie this logic to your component lifecycle so you subscribe/unsubscribe automatically:

useEffect(() => {
  let channel;
  (async () => {
    channel = await reverb.subscribe('private-orders.42');
    channel.listen('OrderUpdated', handleOrderChange);
  })();

  return () => {
    if (channel) channel.unsubscribe();
  };
}, []);

When the backend broadcasts a status change, the app UI updates instantly. Compared to polling every X seconds, this model is vastly more efficient (no battery drain) and offers true “live” UX.

mobile screen shows order status updating in real-time, user holds phone watching ‘On the

Performance:

  • Updates use a single, persistent WebSocket—bandwidth is minimal, no repeated HTTP roundtrips.
  • TurboModule native code in react-native-reverb keeps latency low and scaling predictable.

Takeaway: Live features like order tracking move from multi-day builds to “works out of the box” with this stack.

Best practices and limitations to consider with react-native-reverb

react-native-reverb brings Laravel real-time events natively to mobile, but as with all tools, you need to know its edges.

Scaling and maintenance:
Self-hosted Reverb means you control infra, but you also shoulder uptime, load management, and network hygiene. Hosted Pusher can outscale Reverb without effort, but you pay a premium and give up control.

Authentication security:
Keep your /broadcasting/auth route locked down (ideally token-authenticated and HTTPS-only). Never expose app secrets client-side.

Resource constraints:
Mobile devices can drop connections when in the background. Use built-in reconnect strategies, and always clean up channels to avoid leaks.

Error handling:
react-native-reverb surfaces connection and protocol errors via Promises—handle disconnects, retries, and failures explicitly to avoid silent UI stalls.

// Example retry logic
try {
  await reverb.connect();
} catch (e) {
  setTimeout(() => reverb.connect(), 3000); // retry after delay
}

Takeaway: The tool is solid, but production demands defensive programming and infrastructure awareness.

What this enables: smooth real-time for Laravel mobile apps

react-native-reverb makes Laravel Reverb a first-class backend for React Native real-time apps. For teams that need live data—order tracking, notifications, chat—without giving up control to a hosted platform, it’s a direct path from backend PHP events to user-visible updates in mobile UI. Event-driven features like live tracking go from multi-day integrations to a few lines of code, and you keep every lever of your stack under your control.

For product teams in 2026, this is the durable way to bridge Laravel’s capable backend to native mobile UIs. The real-time UX users expect is now as easy to ship in React Native as it is on web—without writing your own wire protocol or leasing your backend to a third-party.

react-nativebackendannouncement
OTF Fitness Kit

Stop wiring. Start shipping.

  • Auth, DB, and backend already connected — no Supabase setup needed
  • iOS + Android + web from one codebase
  • CLAUDE.md pre-tuned + 40+ tested AI prompts included