SSL 的 PHP Ratchet 问题

标签 php ratchet stunnel

由于我的网站使用 https,我似乎无法连接 Ratchet 。我什至有隧道安装。这是我的配置

演示:https://usyd.chat/react.html (见源代码和控制台)

推送服务器.php

<?php
require dirname(__DIR__) . '/vendor/autoload.php';

$loop   = React\EventLoop\Factory::create();
$pusher = new Unichat\Pusher;

// Listen for the web server to make a ZeroMQ push after an ajax request
$context = new React\ZMQ\Context($loop);
$pull = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->bind('tcp://103.4.16.217:5555'); // Binding to 127.0.0.1 means the only client that can connect is itself
$pull->on('message', array($pusher, 'onInterfere'));

// Set up our WebSocket server for clients wanting real-time updates
$webSock = new React\Socket\Server($loop);
$webSock->listen(8080, '0.0.0.0'); // Binding to 0.0.0.0 means remotes can connect
$webServer = new Ratchet\Server\IoServer(
    new Ratchet\Http\HttpServer(
        new Ratchet\WebSocket\WsServer(
            new Ratchet\Wamp\WampServer(
                $pusher
            )
        )
    ),
    $webSock
);

$loop->run();

这是我连接到我的网络套接字的方式
var conn = new ab.Session('wss://usyd.chat:8080')

最后,我的 stunnel 配置
output = /etc/stunnel/stunnel.log

[websockets]
#cert = /etc/ssl/crt/primary.crt
cert = /etc/stunnel/stunnel.pem
accept = 8443
connect = 8080

当我进入控制台上的 react.html 页面时,没有任何 react 。在我的推手课上,我有
echo "connected"

在 onOpen 方法中也是如此,但它不会在控制台中记录任何内容。

非常感激任何的帮助。
谢谢

最佳答案

看看这个对类似问题的回答:https://stackoverflow.com/a/47200806/3777134

现在您不需要 stunnel 或代理,您可以使用 React\Socket\SecureServer 类直接处理来自 Ratchet 服务器的安全连接。

关于SSL 的 PHP Ratchet 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35592754/

相关文章:

php - Ratchet 与 Laravel

php - 如何检测字符串中是否包含 UTF-8 字符?

php - 一次引用两个php文件

php - 您如何调试 CodeIgniter 应用程序?

php - 如何使用 ReactPHP 和 Ratchet 在同一端口上运行 WebSocket 和 HTTP Server?

java - 在远程计算机上启用端口 8443 以进行 https 访问

php - Doctrine2 - 一次多次插入

php - 监视并重新启动开发中长时间运行的 PHP 进程 (Ratchet)

networking - QuickFix/n 出现 Stunnel "Peer suddenly disconnected"错误

android - 证书签发: SSL page brings up "you need to set a lock screen pin or password before you can use credential storage" on Android