hahadu/think-swoole-socket
Composer 安装命令:
composer require hahadu/think-swoole-socket
包简介
thinkphp swoole socket client&server subscribe
README 文档
README
thinkphp swoole socket client&server subscribe
install
composer require hahadu/think-swoole-socket
main class
create class Swoole.php
namespace app; use Hahadu\ThinkSwooleSocket\subscribe\Swooleable; class Swoole extends Swooleable{ public function onConnect($data){ //$this->push($data); //or //$this->websocket->push(json_encode($data)); } }
config
edit swoole.php for thinkphp config path
[ ... 'websocket' => [ ... 'handler' => Handler::class, //default ... 'subscribe' => [ app\Swoole::class //because namespace app\Swoole ], ] ];
run
console
php think swoole start
if you console show
Starting swoole http server...
Swoole http server started: <http://127.0.0.1:9502>
You can exit with `CTRL-C`
browser going
http://127.0.0.1:9502
other
home page :
github
gitee:
browser javascript client:
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2021-04-26