我已按照本教程的要求构建了一个实时通知系统http://socketo.me/docs/push,并且一切正常。我与服务器建立了新的连接,但是我的问题是我无法使用zeromqContext
发送新的条目数据,因此我可以重新广播给我的用户
这是我的push-server.php
,可以正常工作,并且可以在终端中看到新的连接
DIR)。 '/vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$pusher = new MyApp\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:5555'); // 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('0.0.0.0:8082', $loop); // 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();
我用这段代码在服务器中连接
<script>
var conn = new ab.Session('ws://localhost:8082',
function() {
conn.subscribe('kittensCategory', function(topic, data) {
// This is where you would add the new article to the DOM (beyond the scope of this tutorial)
console.log('New article published to category "' + topic + '" : ' + data.title);
});
},
function() {
console.warn('WebSocket connection closed');
},
{'skipSubprotocolCheck': true}
);
</script>
而且我的问题是,当我发出一个ajax POST请求并将某些内容存储在数据库中,然后运行这3个命令时
$context = new ZMQContext();
$socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher');
$socket->connect("tcp://localhost:5555");
我的apache服务器向我抛出net::ERR_CONNECTION_RESET
,并且它正在重新启动。我在错误日志中看到了这些东西
[[Wed Jun 26 14:16:47.434928 2019] [mpm_winnt:notice] [pid 9768:tid 564] AH00428:父级:子进程1216退出,状态为3221225725-重新启动。[2019年6月26日星期三14:16:47.482972] [ssl:warn] [pid 9768:tid 564] AH01909:www.example.com:443:0服务器证书不包含与服务器名称匹配的ID[2019年6月26日星期三14:16:47.515009] [mpm_winnt:notice] [pid 9768:tid 564] AH00455:配置了Apache / 2.4.39(Win64)OpenSSL / 1.1.1c PHP / 7.2.19-恢复正常运行[2019年6月26日星期三14:16:47.515009] [mpm_winnt:notice] [pid 9768:tid 564] AH00456:Apache Lounge VC15服务器内置:2019年5月29日11:22:50
我搜索了状态码,并用httpd.conf
更新了ThreadStackSize 888888
文件,但出现相同的错误。
我有同样的问题:/您解决了吗?如果是,请回答。