Laravel broadcasting works on Foony through the Pusher protocol, so broadcast(), ShouldBroadcast events, routes/channels.php authorization, and Laravel Echo all run unchanged. You set environment variables instead of running your own WebSocket server. This page is the from-zero setup. The full compatibility reference lives in Pusher and Laravel Echo.
1. Get credentials
Create an app and an API key in the dashboard. One Foony key contains all three Pusher values, as mapped in Pusher and Laravel Echo:
BROADCAST_CONNECTION=pusher
PUSHER_APP_ID=acme-chat
PUSHER_APP_KEY=kid_1a2b3c4d5e6f7g8h
PUSHER_APP_SECRET=your-key-secret
PUSHER_HOST=realtime.foony.io
PUSHER_PORT=443
PUSHER_SCHEME=https
Point the pusher connection in config/broadcasting.php at those host options:
'options' => [
'host' => env('PUSHER_HOST'),
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'useTLS' => true,
],
2. Broadcast an event
Nothing here is Foony-specific, it’s standard Laravel broadcasting:
class OrderShipped implements ShouldBroadcast
{
public function __construct(public Order $order) {}
public function broadcastOn(): Channel
{
return new PrivateChannel('orders.'.$this->order->team_id);
}
}
broadcast(new OrderShipped($order));
Private and presence channels authorize through your existing callbacks in routes/channels.php. Laravel signs the subscription and Foony verifies the signature, so no auth code changes.
3. Listen with Echo
import Echo from 'laravel-echo';
import Pusher from 'pusher-js';
window.Echo = new Echo({
broadcaster: 'pusher',
key: import.meta.env.VITE_PUSHER_APP_KEY,
wsHost: 'realtime.foony.io',
wsPort: 443,
wssPort: 443,
forceTLS: true,
enabledTransports: ['ws', 'wss'],
});
Echo.private(`orders.${teamId}`)
.listen('OrderShipped', (event) => {
console.log(event.order);
});
Echo.join() for presence channels and whisper() for client events work too.
4. Verify
Fire an event from tinker and watch it arrive in the browser console:
php artisan tinker
>>> broadcast(new App\Events\OrderShipped($order));
What to know before production
- Pusher-path events are live-only, they aren’t stored for history. That matches Pusher’s own behavior. If a feature needs a backlog, use the JavaScript SDK on a stored channel for that part.
- Traffic meters as normal messages, per Usage and billing.
- Pusher webhooks and
private-encrypted-channels aren’t supported yet, per the compatibility table.