PHPackages                             zxzgit/swoole-websocket-distributor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. zxzgit/swoole-websocket-distributor

ActiveExtension[Utility &amp; Helpers](/categories/utility)

zxzgit/swoole-websocket-distributor
===================================

v1.0(7y ago)010PHP

Since Dec 7Pushed 7y ago1 watchersCompare

[ Source](https://github.com/zxzgit/swoole-websocket-distributor)[ Packagist](https://packagist.org/packages/zxzgit/swoole-websocket-distributor)[ RSS](/packages/zxzgit-swoole-websocket-distributor/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (2)Used By (0)

swoole-websocket-distributor
============================

[](#swoole-websocket-distributor)

基于 swoole 的 WebSocket\\Server 内容分发，可以将接受的信息分发到模块和控制器。

\#基本用法

基本构建使用参考test目录：

```
--testapp
  --controllers
    --IndexController.php
    --OtherController.php
  --modules
    --test  //test module name
       --controllers
         --IndexController.php
         --OtherController.php
       --MessageModule.php
  --public
    --indexTest.php
  --MessageDistributor.php

```

testapp/public/indexTest.php

```
//#`php indexTest.php` to start a websocket server
\zxzgit\swd\zxzgit\WebSocketApp::run([
    //'serverBind' => '0.0.0.0',//default 0.0.0.0
    //'serverPort' => '9502',//default serverPort
    'moduleList' => [
        'test' => \testapp\test\modules\test\MessageModule::class,
    ],
    'messageDistributor' => \testapp\test\MessageDistributor::class,
    'event' => [
        'initConnector' => function () {

        },
        'workerStart' => function (&$server, $id) {
            echo PHP_EOL . "workerStart event" . PHP_EOL;
        },
        'open' => function (&$server, &$req) {
            echo PHP_EOL . "open event" . PHP_EOL;
        },
        'beforeMessage' => function (&$server, &$frame) {
            echo PHP_EOL . "beforeMessage event" . PHP_EOL;
        },
        'afterMessage' => function (&$server, &$frame) {
            echo PHP_EOL . "afterMessage event" . PHP_EOL;
        },
        'close' => function (&$server, $fd) {
            echo PHP_EOL . "afterMessage event" . PHP_EOL;
        },
    ]
]);

```

testapp/controllers/IndexController.php

```
class IndexController extends \zxzgit\swd\libs\AbstractController {
    //clien send json data {"route":"index/index","data":{"key1":"value1"}} can route to this action method
    public function actionIndex(){
        return $this->pushMsg(['hello', 'world']);
    }
}

```

testapp/MessageDistributor.php

```
class MessageDistributor extends \zxzgit\swd\libs\MessageDistributor{
    public $moduleList = [
        //'test' => \zxzgit\swd\test\modules\test\MessageModule::class,
    ];
}

```

testapp/modules/test/MessageModule.php

```
class MessageModule extends \zxzgit\swd\libs\MessageModule{}

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity61

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2717d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e6b716063f6719eb0cb3ea8832c27ffedc0b95cfd490dfac981ff01ada270f1?d=identicon)[zxzgit](/maintainers/zxzgit)

### Embed Badge

![Health badge](/badges/zxzgit-swoole-websocket-distributor/health.svg)

```
[![Health](https://phpackages.com/badges/zxzgit-swoole-websocket-distributor/health.svg)](https://phpackages.com/packages/zxzgit-swoole-websocket-distributor)
```

###  Alternatives

[apen/additional_reports

Useful information in the reports module : xclass, ajax, cliKeys, eID, general status of the system (encoding, DB, php vars...), hooks, compare local and TER extension (diff), used content type, used plugins, ExtDirect... It can really help you during migration or new existing project (to have a global reports of the system).

14157.8k](/packages/apen-additional-reports)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
