Código
public function pusher(){ 'category' => $this->input->post('category'), 'title' => $this->input->post('title'), 'article' => $this->input->post('article'), ); //$this->notification->addNotification($entryData); // This is our new stuff $context = new ZMQContext(); $socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher'); $socket->connect("tcp://localhost:5555"); }
Código
var sock = new ab.Session('ws://192.168.0.4:8080', function() { sock.subscribe('kittensCategory', function(topic, data) { $badge.show(); $badge.text(parseInt($badge.text()) + 1); $list.find(".item").eq(13).nextAll(".item").remove(); var item = '<li class="item text-warning"><a href="#"><span class="text-warning">' + '<i class="fa fa-exclamation-triangle fa-fw"></i>'+data.title+' is low'+'</span>' + '<span class="pull-right text-muted small" data-time="">'+data.timestamp+'</span></a></li>' + '<li class="item divider"></li>'; $list.prepend(item); $('.dropdown.open .dropdown-toggle').dropdown('toggle'); }); }, function() { console.warn('WebSocket connection closed'); }, { 'skipSubprotocolCheck': true } );