Answer the question
In order to leave comments, you need to log in
Subscription not working in Ratchet?
I use Ratchet. The user connects, that is, onOpen works, but nothing happens when the subscription user connects. I do according to the documentation: socketo.me/docs/push
Here is the code:
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);
});
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question