fixed
This commit is contained in:
@@ -15,6 +15,36 @@ use wanghua\general_utility_tools_php\http\Curl;
|
||||
use wanghua\general_utility_tools_php\tool\Tools;
|
||||
use Workerman\Worker;
|
||||
|
||||
|
||||
/**
|
||||
* 本事件监控逻辑
|
||||
*
|
||||
* 1、安装长连接框架:composer require workerman/gateway-worker
|
||||
|
||||
* 2、配置基本参数
|
||||
* 配置为文件为 config/gateway_worker.php(必须使用对应命令才能启动)
|
||||
* 配置端口startPort,pingData,eventHandler,其它默认就好
|
||||
* eventHandler配置为app\index\logic\events\Events.php类,用于处理监听后的业务逻辑
|
||||
* 3、启动服务
|
||||
* 启动命令为:php think worker:gateway
|
||||
* 4、 nginx服务配置以支持/wss方式访问
|
||||
* 参考配置:
|
||||
* location /wss
|
||||
{
|
||||
proxy_pass http://127.0.0.1:2000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
* 5、JavaScript客户端建立连接并访问
|
||||
* ws = new WebSocket("wss://boomim.playone.cn/wss");//这种访问方式需要nginx配置
|
||||
ws.onopen = function() {
|
||||
alert("连接成功");
|
||||
ws.send('hello,thinkphp');
|
||||
alert("给服务端发送一个字符串:hello,thinkphp");
|
||||
};
|
||||
*/
|
||||
class Events extends \think\worker\Events
|
||||
{
|
||||
|
||||
@@ -209,7 +239,7 @@ class Events extends \think\worker\Events
|
||||
//$url = 'https://boomim.playone.cn/api/Partnermerchants/offline';
|
||||
//Curl::curl_post($url,['clientid'=>$client_id]);
|
||||
|
||||
(new UserLogic())->offline($client_id);
|
||||
//(new UserLogic())->offline($client_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user