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

thinkphp6 阿里云 stream_socket_client(): unable to

w5w4

問題描述

之前部署過好幾個gatewayworker + thinkphp+ 第一次出現(xiàn)這種問題
1. (我只是一臺服務(wù)器 沒做分布式)
2. 第一次用阿里云服務(wù)器搭建
thinkphp bindUid的時候就提示
stream_socket_client(): unable to connect to tcp://127.0.0.1:29** (Connection refused)
php start.php status
php start.php start
php start.php start -d 都沒問題
直接通過webscket聊天也沒問題
但是通過GatewayClient\Gateway就報錯 大佬們遇到過嗎

start_register.php:

<?php 
/**
 * This file is part of workerman.
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the MIT-LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @author walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link http://wtbis.cn/
 * @license http://www.opensource.org/licenses/mit-license.php MIT License
 */
use \Workerman\Worker;
use \GatewayWorker\Register;

// 自動加載類
require_once __DIR__ . '/../../vendor/autoload.php';

// register 必須是text協(xié)議
$register = new Register('text://0.0.0.0:1238');

// 如果不是在根目錄啟動,則運行runAll方法
if(!defined('GLOBAL_START'))
{
    Worker::runAll();
}

thinkphp

<?php

namespace app\api\controller;

use app\api\service\file\UploadService;
use app\api\service\user\UserLogService;
use app\api\service\user\UserService;
use GatewayClient\Gateway;
use think\facade\Request;

class User extends Base
{
    public function bind()
    {
        Gateway::$registerAddress = "127.0.0.1:1238";
        Gateway::sendToAll("11111"); //這里不會報錯但是沒發(fā)送成功
        Gateway::bindUid(Request::param('client_id'), 1);
        return msg(Request::param('client_id'));
    }
}
2219 4 0
4個回答

Gin

Gateway::$registerAddress = "127.0.0.1:1238"; 127.0.0.1 換成服務(wù)器的內(nèi)網(wǎng)地址 試試

  • w5w4 2023-03-29

    還是不行 換了局域網(wǎng)IP 還是提示 unable to connect to tcp://127.0.0.1:2918 (Connection refused)

  • Gin 2023-03-29

    確定 gatewayworker 是啟動著的?

  • w5w4 2023-03-29

    是的
    php start.php status 正常的
    php start.php start 控制臺沒報錯
    php start.php start -d 都沒問題
    websocket也沒問題正常使用

  • yongdao35 2023-03-29

    client_id 里包含了一些ip及端口信息,如果client_id是錯的,就會有這個問題

yongdao35

http://wtbis.cn/doc/gateway-worker/work-with-other-frameworks.html#%E5%85%B3%E4%BA%8EGatewayClient

手冊說如果GatewayClient和GatewayWorker不是在同一臺服務(wù)器上,則需要先將start_gateway.php中的lanIp改成當前服務(wù)器的內(nèi)網(wǎng)ip。看看是不是這個問題

  • w5w4 2023-03-29

    我在一臺服務(wù)器。。 而且我改成了內(nèi)網(wǎng)ip也不行

  • w5w4 2023-03-29

    謝謝 我剛才測試了 真有可能是 client_id的問題 我Android studio 那邊返回的ID格式是 7f0000010b6600040ae3 就會報錯
    但是我用其他方式返回的ID格式是 ac13c7ce0fa000000002 就不會報錯
    應(yīng)該是這個原因 我再看看 感謝你

w5w4

剛剛換成局域網(wǎng)IP  也不行

  • w5w4 2023-03-29

    剛剛緩存局域網(wǎng)ip 也不行

  • w5w4 2023-03-29

    -換成

w5w4

占用大家的網(wǎng)絡(luò)資源和時間非常抱歉
這個就是client_id 不存在導(dǎo)致的

導(dǎo)致這樣的原因是。。。。
服務(wù)器太多了 Android Studio填錯ws IP了 = =

年代過于久遠,無法發(fā)表回答
??