I just want to clarify (with your help) the connection between: PHP + Redis + Node.js + Sockets
.
For that I took as a base example the project on:
https://github.com/biswassampad/Realtime-Chat-With-Laravel5.6-and-Socket.io
This exmaple is a very basic chat application.
Here you have a demo video: https://www.youtube.com/watch?v=AMgYpjFXnWo
I downloaded it to local and worked fine.
I noticed that it makes use of: PHP
+ Redis
+ Node.js
+ Sockets
.
I would like to analyze different diagrams I created and pasted below which you can find on the following url (if you want you can edit them and export the worksheet link through: https://shorturl.at
and then paste the new images and / or link on this thread).
Diagram 1:
Question 1: Could you please, let me know if the diagram above is right or if I'm confusing / missing something relevant? That diagram is based on the GitHub
project referenced at the beginning of this post.
Diagram 2:
Question 2: What about if we get rid of Redis
?. Node.js
can create sockets, broadcast messages, etc., as you can see on the following documentation:
What is the key feature
of Redis
that makes everybody recommend it for this kind of projects.
Diagram 3:
Question 3: Why is not possible to do everything with PHP/Apache
on the server side?. Is not possible for PHP
to open sockets in the same way as Node.js
does?. What magic powers has Node.js
that PHP
doesn't?
[EDIT 1]
Question 4:
On the following tutorial:
https://medium.com/@adnanxteam/how-to-use-laravel-with-socket-io-e7c7565cc19d
which is also about PHP + Redis + Node.js + Sockets
, they use: laravel-echo-server
.
Why on the GitHub
sample project above is not used that plugin?