Pages

30 March, 2021

Ably Broadcast Driver for Laravel

 

Ably Broadcast Driver for Laravel

Ably Broadcaster is a Laravel package by Matthew Hall that adds support for the Ably real-time messaging service. Backed by the Ably PHP SDK, this package adds a custom Laravel broadcast driver.

You can use this broadcast driver as an alternative to Pusher, which is fantastic that Laravel developers have more choices when it comes to real-time messaging.

After you complete the setup found in the readme, the frontend keeps using the Pusher JS library, but you’ll use the Ably WebSocket host:

import Echo from "laravel-echo"

window.Pusher = require('pusher-js');

window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_ABLY_KEY,
wsHost: 'realtime-pusher.ably.io',
wsPort: 443,
disableStats: true,
encrypted: true,
});

This package works with public, private, and presence channels. You can check out this package on GitHub at springboardVR/Laravel-Ably-Broadcaster.

No comments:

Post a Comment

Thanks