1

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.

Abhishek Pundir
  • 101
  • 2
  • 11

1 Answers1

11
  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

Community
  • 1
  • 1
Dinh Phong
  • 596
  • 3
  • 12