[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: php ZMQ , Ratchet Push сервер
maruo
Такая вот проблема. На локальной машине все круто работает.

Но вот перенес все на Выделенный сервер.
И Push работает очень странно, он часто просто не посылает ничего, хотя событие было,
просто молчит, и так часто, иногда присылает данные, иногда нет.

Мб я что то с адресами и портами запутался?

Push
<?php
namespace components;

use base\BasePusher;
use helpers\Json;
use ZMQContext;

class SocketPusher extends BasePusher {
/**
* Send data
*
@param array, data;
*/

public static function sendDataToServer(array $data) {
$context = new ZMQContext;
$socket = $context->getSocket(\ZMQ::SOCKET_PUSH, 'my pusher');
$socket->connect('tcp://185.162.92.103:61184');
$socket->send(Json::encode($data));
}
public function broadcast($jsondata) {
$data = Json::decode($jsondata);
if (!array_key_exists($data['topic_id'], $this->subscribedTopics)) {
return;
}
$topic = $this->subscribedTopics[$data['topic_id']];
// re-send the data to all the clients subscribed to that category
$topic->broadcast($data);

}



socket-server.php

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

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

$webSock
);


client
 var conn = new ab.Session(
'ws://185.162.92.103:5555',
function() {//....
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.