反应警告 "stream_select(): cannot represent a stream of type ZMQ_FD as a select()able descriptor"

React warning "stream_select(): cannot represent a stream of type ZMQ_FD as a select()able descriptor"

我是第一次尝试使用 Ratchet,正在关注 the push tutorial

我在push-server.php中有以下代码:

namespace app\ratchet;
require_once(__DIR__ . '/../common_functions.php'); // my autoloader
require __DIR__ . '/../../vendor/autoload.php'; // composer autoloader

use app\ratchet\Pusher;

use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;

$loop   = \React\EventLoop\Factory::create();
$pusher = new 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://127.0.0.1:8184'); // Binding to 127.0.0.1 means the only client that can connect is itself
$pull->on('message', array($pusher, 'onBlogEntry'));

// Set up our WebSocket server for clients wanting real-time updates
$webSock = new \React\Socket\Server($loop);
$webSock->listen(8185, '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();

当我 运行 文件时,我收到以下警告

Warning: stream_select(): cannot represent a stream of type ZMQ_FD as a select()able descriptor in [...]\vendor\react\event-loop\StreamSelectLoop.php on line 255

Call Stack:
    0.0000     237608   1. {main}() [...]\app\ratchet\push-server.php:0
    0.0130    1400696   2. React\EventLoop\StreamSelectLoop->run() [...]\app\ratchet\push-server.php:36
    0.0130    1401688   3. React\EventLoop\StreamSelectLoop->waitForStreamActivity() [...]\vendor\react\event-loop\StreamSelectLoop.php:201
    0.0130    1402240   4. React\EventLoop\StreamSelectLoop->streamSelect() [...]\vendor\react\event-loop\StreamSelectLoop.php:221
    0.0130    1402384   5. stream_select() [...]\vendor\react\event-loop\StreamSelectLoop.php:255

\vendor\react\event-loop\StreamSelectLook.php中引用的行是:

return stream_select($read, $write, $except, $timeout === null ? null : 0, $timeout);

我以前从未使用过 Ratchet 或 ZeroMQ,我很难理解问题所在。搜索此内容时,我在 Google 上找不到任何有用的信息。

我 运行在 Windows 7 x 64 上安装 WampServer x 64。我按照 this guide 如何安装 ZMQ。

下面是一些调试截图:

是什么导致了这个问题,我该如何解决?

在尝试解决此问题大约五个小时后,我根据某处阅读的评论尝试安装 32 位版本的 WampServer,问题已解决。所以看来 stream_select() 问题是由 WampServer 的问题引起的。

我会把这个问题留在这里,因为我确定有人 运行 会在某个时候遇到同样的问题,希望这会为他们节省很多时间。