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.
Asked
Active
Viewed 5,371 times
1 Answers
11
- You should have a
NodeJSandsocket.io, install it on your server - When have event, use
Redisto hold your variable and send it to yourNodeJsor Use this PHP Library, you can send variable fromPHPtoNodeJSServer: 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 (usingemitandon)
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
Community
- 1
- 1
Dinh Phong
- 596
- 3
- 12