Download the PHP package jcbowen/yiiswoole without Composer
On this page you can find all versions of the php package jcbowen/yiiswoole. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package yiiswoole
yiiSwoole
介绍
Yii2 + Swoole4
目前实现了websocket服务器,同时支持了高性能共享内存Table的使用
不兼容说明
使用了usleep,所以不兼容win环境
前提
服务器中需要安装swoole4
(如果是宝塔搭建的环境,直接在使用的php版本中安装swoole4扩展)
由于某些跟踪调试的 PHP 扩展大量使用了全局变量,可能会导致 Swoole 协程发生崩溃。请关闭以下相关扩展:
安装教程
composer执行
或者在 composer.json 加入
配置说明
在console/config/main.php的controllerMap中加入配置
使用
运行说明
websocket客户端向服务器发送json字符串,如:
如果握手的时候,携带了目录路径,该路径将会作为route缓存起来;请求中如果携带了route字段,则替换缓存中的route
通过执行方法,可以读取上下文中缓存的信息;
通过执行方法,可以读取上下文中缓存的get数据;
其中server和frame会被缓存到中;
接收到的json会被转为数组后缓存到中;
携带的目录代表的是监听到动作后转发到哪个路由(由于通过console运行的进程,所以这里的路由指的是console里的路由)。
总结:jcbowen/yiiswoole插件会在websocket触发onmessage时,根据route调用对应的控制器方法,并将websocket服务和接收到数据分别存放到与中;
在控制器方法中使用
All versions of yiiswoole with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.4
yiisoft/yii2 Version ^2.0
ext-posix Version *
ext-json Version *
jcbowen/jcbase-yii2 Version ^0.x-dev || >=0.30.0
yiisoft/yii2 Version ^2.0
ext-posix Version *
ext-json Version *
jcbowen/jcbase-yii2 Version ^0.x-dev || >=0.30.0
The package jcbowen/yiiswoole contains the following files
Loading the files please wait ...