AsyncTcpConnection链接ws报错 返回404

wulianka

问题描述

这里详细描述问题

程序代码

<?php
require_once __DIR__ . '/../../vendor/autoload.php';
use Workerman\Connection\AsyncTcpConnection;
use Workerman\Worker;
$worker = new Worker('text://0.0.0.0:6161');
$worker->onWorkerStart = function ($worker) {
    // ssl需要访问443端口 
    $clientId = '2bdb33f07106491ebd140b61878156';
    $clientSecret = '843652907d245a759b30cd14b781d6cfe3d58';
    $url = 'ws://message-api.yangkeduo.com:443/clientId=' . $clientId . '&clientSecret=' . $clientSecret;

    $con = new AsyncTcpConnection($url);

    // 设置以ssl加密方式访问,使之成为wss
    $con->transport = 'ssl';

    $con->onConnect = function ($con) {
        $content='链接成功';
        echo $content;
        print_r($content, 1);
    };

    $con->onMessage = function ($con, $data) {
        var_export($data);
        print_r($data, 1);
    };

    $con->onClose=function ($con){
        $content='关闭连接';
        echo $content;
        print_r($content, 1);
        //error_log(print_r($content, 1), 3, '/home/workerman/output.log');
    };

    $con->connect();
};
Worker::runAll();

报错信息

截图

571 2 0
2个回答

喵了个咪

访问的地址不存在

  • 暂无评论
小W

你是客户端,直接wss

  • 暂无评论
年代过于久远,无法发表回答
×
🔝