Не может подключиться к порту tcp на локальном сервере Wampserver с Reactionphp/ZMQ
Я пытаюсь отправить уведомление некоторым клиентам, поэтому я использую модуль ZMQ (Push-интеграция). все в порядке и все пользователи могут подключиться и подписаться, но onBlogEntry
не запускается, а также php не отображает никаких ошибок. похоже на то tcp://127.0.0.1:5555
не работает нормально. Я использую Wampserver, PHP5.5 и Apache 2.4 на Windows 10. Также я отключил брандмауэр моего ПК, заранее спасибо за вашу помощь. вот мои серверные коды (получатель):
<?php
require 'vendor/autoload.php';
require 'classes/WebSocketCon.php';
$loop = React\EventLoop\Factory::create();
$pusher = new WebSocketCon;
// 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:8081', $loop);
$webServer = new Ratchet\Server\IoServer(
new Ratchet\Http\HttpServer(
new Ratchet\WebSocket\WsServer(
new Ratchet\Wamp\WampServer(
$pusher
)
)
),
$webSock
);
$loop->run();
вот коды отправителя:
require_once("vendor/autoload.php");
$context = new ZMQContext();
$socket = $context->getSocket(ZMQ::SOCKET_PUSH,"pusher");
$socket->connect("tcp://127.0.0.1:5555");
$entryData = array(
'category' => "sm"
, 'title' => "saleh"
, 'when' => time()
);
$socket->send(json_encode($entryData));
вот яваскрипты:
var conn = new ab.Session('ws://localhost:8081',
function() {
conn.subscribe('sm', function(topic, data) {
// This is where you would add the new article to the DOM (beyond the scope of this tutorial)
console.log(data);
alert('New article published to category "' + topic + '" : ' + data.title);
});
},
function() {
console.warn('WebSocket connection closed');
},
{'skipSubprotocolCheck': true}
);