dongshao8566 2017-05-01 05:21
浏览 51

使用棘轮websocket推送通知

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器