kanata-php/socket-conveyor
Composer 安装命令:
composer require kanata-php/socket-conveyor
包简介
A WebSocket/Socket message Router
README 文档
README
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+.
Documentation
- 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.
Using Conveyor as a Pusher/Reverb server
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=http
The 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.
统计信息
- 总下载量: 929
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 4
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-29