Download the PHP package aston/distribute-ws without Composer

On this page you can find all versions of the php package aston/distribute-ws. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package distribute-ws

Hyperf 分布式 websocket 解决方案

场景:

1、多个 websocket server 2、客户端 clientA 连接到 serverA 得到 fdA, clientB 连接到 serverB 得到 fdB 3、clientA 想要给 clientB 发送消息

注:fd 类似于当前链接的文件描述符,每一次新的连接会自增 1 ,可以理解为连接号

问题:clientA 和 clientB 连接到的是不同的服务器,fd 作用域仅限于当前服务器,要想跨服务器想实现通讯,需要借助中间件来传递消息

环境:

php >=7.2 hyperf >= 2.2

理论参考

Hyperf搭建websocket集群项目(通过redis发布订阅)

安装

使用 composer

发布配置文件

配置文件说明

使用方法演示

根据hyperf官方文档搭建好websocket服务器

在控制器中注入本服务

注意的点:由于redis的subscribe方法是阻塞的,框架启动时会自动启动一个自定义进程,该进程只负责订阅和回调,不影响其他进程,收到订阅消息后执行回调即可

验证:

本地开启两个不同端口的 server

配置 env

HTTP_PORT=9501 WS_PORT=9502 DISTRIBUTE_SERVER_ID=server1

启动第一个服务器

修改 env

HTTP_PORT=9503 WS_PORT=9504 DISTRIBUTE_SERVER_ID=server2

启动第二个服务器

写一个简易的view当作websocket客户端

我这里的demo是想要实现给指定的uid发送消息

然后分别连接到两个不同的websocket服务器

效果演示

Hyperf搭建websocket集群项目(通过redis发布订阅)


All versions of distribute-ws with dependencies

PHP Build Version
Package Version
Requires hyperf/process Version ~3.0.0
psr/container Version ^1.0|^2.0
hyperf/utils Version ~3.0.0
hyperf/async-queue Version ~3.0.0
hyperf/websocket-server Version ~3.0.0
hyperf/redis Version ~3.0.0
ext-redis Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aston/distribute-ws contains the following files

Loading the files please wait ....