dongzaliang4492 2016-08-08 17:34
浏览 50
已采纳

如何在laravel中生成像facebook这样的实时通知系统[关闭]

I want to create a real time notification system for my website(social network) I'm using laravel 5.2, I am using socket.io and redis currently, I have created notifevent and broadcasted it succesfully, but no idea what to do ahead, can anyone please help me with it or guide me.

  • 写回答

1条回答 默认 最新

  • douju2053 2016-08-08 18:03
    关注
    1. You should have a NodeJS and socket.io, install it on your server
    2. When have event, use Redis to hold your variable and send it to your NodeJs or Use this PHP Library, you can send variable from PHP to NodeJS Server: http://elephant.io/
    3. Data Processing on the NodeJs
    4. Return it to PHP Webpage use Socket.io (client javascript) to catch this event and display for end-user (using emit and on)

    You can follow this instruction with elephant.io: Using PHP with Socket.io

    or that with Redis: https://github.com/laracasts/Laravel-Redis-and-Socket.io

    You should try two ways and feedback with new question if you stuck because your question is unclear and very hard to answer

    You can use javascript send Ajax Request and get variable from PHP and use this variable to make a socket.emit but this way is less security, you must use token or anything like this if you want to public your website

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用