I'm working with codeigniter, and ratchet websocket, I have set up codeigniter with ratchet well, but im having problems with logic, I have to do in codeigniter and ratchet, I want to send notifications to a specif user in my model , addNotification, checkForNotifications, getNotifications , ,removeUserNotifications, removeNotifications
if ($arr = getNotifications() > 0){
//Mostrar en tabla $arr
if $arr[0].type == UNREAD
//mostar un icono adecuado para unread
else if $arr[0].type == NEW
//mostar un icono adecuado para new
else if $arr[0].type == VIEWED
//mostar un icono adecuado para viewd
}else{
echo "No tienes notifications"
}
then send them
how can I do it?
public function websocket(){
$entryData = array(
'category' => $_POST['category'],
'title' => $_POST['title'],
'article' => $_POST['article'],
'when' => time()
);
$context = new ZMQContext();
$socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher');
$socket->connect("tcp://localhost:5555");
$socket->send(json_encode($entryData));
}
i need someone could help how can I do it dinamically without touch views, just controller and model because the own system will do it