定制 kanata-php/socket-conveyor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

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

GitHub 信息

  • Stars: 11
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固