@maksim_fix
Junior PHP developer

Не работает подписка в Ratchet?

Использую Ratchet. Пользователь коннектится, то есть onOpen работает, но при подключении юзеру подписки ничего не происходит. Делаю по документации: socketo.me/docs/push
Вот код:
var conn = new ab.connect('ws://localhost:8080',
                function(session) {
                    session.subscribe('kittensCategory', function(topic, data) {
                        // This is where you would add the new article to the DOM (beyond the scope of this tutorial)
                        alert(101111);
                        console.log('New article published to category "' + topic + '" : ' + data.title);
                    });
                },
                function() {
                    console.warn('WebSocket connection closed');
                },
                {
                    'maxRetries': 60,
                    'retryDelay': 4000,
                    'skipSubprotocolCheck': true
                }
            );

Вот этот код не работает(даже алерт не выводится):
function(session) {
                    session.subscribe('kittensCategory', function(topic, data) {
                        // This is where you would add the new article to the DOM (beyond the scope of this tutorial)
                        alert(101111);
                        console.log('New article published to category "' + topic + '" : ' + data.title);
                    });
                },
  • Вопрос задан
  • 27 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы