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 对于知识的学以致用的解释
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败