国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

[ERROR] stream_socket_client(): unable to connect to tcp://127.0.0.1:2902 (Connection refused)

phper1

PHP 框架使用的是 codeigniter4,前端用的是 uniapp,gatewayworker 從官網(wǎng)下載的 linux 版本,gatewayclient 使用composer 安裝。gatewayWorke、gatewayclient 和應(yīng)用使用同一服務(wù)器。

App/Gatewayworker/Applications/YourApp/start.gateway.php中只做了一處修改:將原來(lái)的:

$gateway = new Gateway(" tcp://0.0.0.0:8282");

改成了 websocket 協(xié)議:

$gateway = new Gateway("websocket://0.0.0.0:8282"); ```

App/Gatewayworker/Applications/YourApp/Events.php中,只對(duì) onConnect 做了以下修改:

public static function onConnect($client_id)
{
Gateway::sendToClient($client_id, json_encode(array(
'type' => 'init',
'client_id' => $client_id
)));
// 向當(dāng)前client_id發(fā)送數(shù)據(jù)
Gateway::sendToClient($client_id, "Hello $client_id\r\n");
// 向所有人發(fā)送
Gateway::sendToAll("$client_id login\r\n");
}```

前端使用 websocket 連接,在收到'init'和 client_id的信息后,通過(guò) bind_uid 接口向后臺(tái)上傳 uid 和 client_id 兩個(gè)參數(shù)。

后臺(tái)接收前端上傳的 uid 和 client_id 兩個(gè)參數(shù)后,進(jìn)行綁定。后臺(tái)代碼如下:

<?php namespace App\Controllers;
require_once '../vendor/autoload.php';
use CodeIgniter\Controller;
use App\Models\Push_model;
use GatewayClient\Gateway;

Class Push2 extends Controller
{
    public function __construct()
    {
        Gateway::$registerAddress = '127.0.0.1:1238';
    }

    public function bind_uid()
    {
        $uid       = $this->request->getPost('uid');
        $client_id = $this->request->getPost('client_id');
        try
        {
            Gateway::$registerAddress = '127.0.0.1:1238';
            Gateway::bindUid($client_id, $uid);
            $message = "binding is fixed";
            Gateway::sendToUid($uid, json_encode($message));
}
        catch (\Exception $e)
        {
            log_message('error', '[ERROR] {exception}', ['exception' => $e]);
        }
    }

問(wèn)題:
1.前端上傳后,收不到返回的消息
2.打印錯(cuò)誤日志,報(bào)如下內(nèi)容:

(Connection refused) /srv/vendor/workerman/gatewayclient/Gateway.php:1187
ERROR - 2021-08-28 08:28:03 --> [ERROR] stream_socket_client(): unable to connect to tcp://127.0.0.1:2903 (Connection refused) /srv/vendor/workerman/gatewayclient/Gateway.php:1188

已經(jīng)做過(guò)的嘗試:
1.服務(wù)器端口放行1238、2900、8282
2.重啟過(guò) gateway 服務(wù)器
以上調(diào)整沒(méi)有效果。

請(qǐng)高手指點(diǎn)。十分期待,感謝感謝!??!

6032 3 0
3個(gè)回答

six

服務(wù)端debug運(yùn)行,看下是不是有報(bào)錯(cuò)。
或者運(yùn)行php start.php status看

  • phper1 2021-08-29

    謝謝回復(fù)。

    服務(wù)端 debug 模式運(yùn)行,不輸出錯(cuò)誤。
    服務(wù)端 php start.php status,提示:

    Workerman[start.php] status 
    Workerman[start.php] not run
phper1

謝謝回復(fù)。

服務(wù)端 debug 模式運(yùn)行,不輸出錯(cuò)誤。
服務(wù)端 php start.php status,提示:

Workerman[start.php] status 
Workerman[start.php] not run
  • 暫無(wú)評(píng)論
six

咋會(huì)not run,not run就是沒(méi)啟動(dòng)啊

  • phper1 2021-08-30

    是的,我目前的排除方向,是不是因?yàn)槲矣?docker,導(dǎo)致容器相互隔絕造成的。開(kāi)放了端口我再測(cè)試一下。謝謝你~~

  • phper1 2021-08-31

    一圈下來(lái),問(wèn)題仍然沒(méi)有解決。php.start status 輸出 not run. 那這個(gè)沒(méi)有啟動(dòng)的原因是什么呢?該怎么解決呢?

  • six 2021-09-04

    不用docker試下呢,排除docker問(wèn)題

年代過(guò)于久遠(yuǎn),無(wú)法發(fā)表回答
??