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关注
- You should have a
NodeJS
andsocket.io
, install it on your server - When have event, use
Redis
to hold your variable and send it to yourNodeJs
or Use this PHP Library, you can send variable fromPHP
toNodeJS
Server: http://elephant.io/ - Data Processing on the
NodeJs
- Return it to PHP Webpage use
Socket.io (client javascript)
to catch this event and display for end-user (usingemit
andon
)
You can follow this instruction with
elephant.io
: Using PHP with Socket.ioor that with
Redis
: https://github.com/laracasts/Laravel-Redis-and-Socket.ioYou 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 fromPHP
and use this variable to make asocket.emit
but this way is less security, you must usetoken
or anything like this if you want to public your website本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报 - You should have a
悬赏问题
- ¥15 对于知识的学以致用的解释
- ¥50 三种调度算法报错 有实例
- ¥15 关于#python#的问题,请各位专家解答!
- ¥200 询问:python实现大地主题正反算的程序设计,有偿
- ¥15 smptlib使用465端口发送邮件失败
- ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
- ¥15 对于squad数据集的基于bert模型的微调
- ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
- ¥20 steam下载游戏占用内存
- ¥15 CST保存项目时失败