这里详细描述问题
<?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();
访问的地址不存在
你是客户端,直接wss