浏览代码

测试推送

lizhen_gitee 1 年之前
父节点
当前提交
c43e9865e6
共有 2 个文件被更改,包括 19 次插入3 次删除
  1. 17 0
      application/index/controller/News.php
  2. 2 3
      application/index/controller/Test.php

+ 17 - 0
application/index/controller/News.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace app\index\controller;
+
+use think\Controller;
+
+use \GatewayClient\Gateway;
+class News extends Controller
+{
+    public function test(){
+
+        $Gateway = new Gateway();
+        $Gateway::$registerAddress = '127.0.0.1:2345';
+        $Gateway::sendToAll('来自服务端client的主动推送'.date('Y-m-d H:i:s'));
+
+    }
+}

+ 2 - 3
application/index/controller/Test.php

@@ -4,15 +4,14 @@ namespace app\index\controller;
 
 use think\Controller;
 
-//use \GatewayWorker\Lib\Gateway;
-require_once VENDOR_PATH . 'workerman/gateway-worker/src/Lib/Gateway.php';
+use \GatewayWorker\Lib\Gateway;
 class Test extends Controller
 {
     public function test(){
 
         $Gateway = new Gateway();
         $Gateway::$registerAddress = '127.0.0.1:2345';
-        $Gateway::sendToAll('来自主动服务端的推送'.date('Y-m-d H:i:s'));
+        $Gateway::sendToAll('来自服务端的主动推送'.date('Y-m-d H:i:s'));
 
     }
 }