/* * Subscribe Session */ var conn = new ab.Session('ws://localhost:8080', function() { conn.subscribe('kittensCategory', function(topic, data) { console.log('New article published to category "' + topic + '" : ' + data.title); $('#new-articles').prepend('
'+data.title+'
'+data.article+'
'); }); }, function() { console.warn('WebSocket connection closed'); }, {'skipSubprotocolCheck': true} );