This package enables PHP 8.2+ applications to work with WebSocket messages
using a routing strategy. Add an action handler implementing ActionInterface
to the SocketMessageRouter, or run Conveyor in Pusher/Reverb-compatible mode
for Laravel Echo clients.
Socket Conveyor is built on OpenSwoole. You can find out more about using WebSockets with OpenSwoole here.
Built for PHP 8.2+.
- Complete usage guide: installation, native Conveyor mode, Pusher/Reverb-compatible mode, Laravel Echo setup, HTTP endpoints, smoke testing, and troubleshooting.
- Laravel Echo / Reverb compatibility guide:
the shortest path for using Conveyor with Laravel's built-in
reverborpusherbroadcaster. - Real Pusher client smoke example: local
browser smoke test using
pusher-jsand Laravel Echo. - Project documentation site.
Conveyor can run in a Pusher-compatible mode for Laravel's stock pusher or
reverb broadcaster and the standard pusher-js / Laravel Echo client.
use Conveyor\Constants;
use Conveyor\ConveyorServer;
(new ConveyorServer())
->port(8080)
->conveyorOptions([
Constants::WEBSOCKET_SUBPROTOCOL => Constants::PUSHER,
Constants::USE_PRESENCE => true,
Constants::APPS => [[
'app_id' => 'local',
'key' => env('REVERB_APP_KEY'),
'secret' => env('REVERB_APP_SECRET'),
'enable_client_messages' => true,
'enabled' => true,
]],
])
->start();Point Laravel at the Conveyor host and port with the normal Reverb/Pusher env values:
BROADCAST_CONNECTION=reverb
REVERB_APP_ID=local
REVERB_APP_KEY=your-app-key
REVERB_APP_SECRET=your-app-secret
REVERB_HOST=127.0.0.1
REVERB_PORT=8080
REVERB_SCHEME=httpThe Pusher mode accepts WebSocket clients at /app/{key} and exposes the
signed REST publish API at /apps/{app_id}/events,
/apps/{app_id}/batch_events, and the channel info endpoints under
/apps/{app_id}/channels.