Reputation: 1092
I spend a week teaching what are Websockets
and how to use them. What is the logic and architecture of all this. I want to create a simple Laravel application with live-chat or live-notifications.
So, at the moment I found tens of ways and nothing concrete from A to Z. Using Redis
, NodeJS
, socket.io
and Laravel
. Using Ratchet
library, using 3-rd party services like Pusher.com
.
Someone suggested me that Laravel
, Laravel echo
and socket.io
and nothing more.
I really get in stuck. From my understanding, anyway for achieving it all, we need 2 Servers, one back-end(Laravel
), one for WebSockets
, and client-side for emit
and listen
for events.
What is the easiest technologies for achieve it w/o 3-rd party priced services, and why?
From one tutorial, I found an idea of creating a server at NodeJS
and socket.io
for server&client. And create a easy live-chat. But have no Idea how to connect it all now with Laravel, and if it's the right way.
Can please someone explain all that logic and give a good advice and explanation of all that process?
P.S. I read broadcasting Laravel documentation and tons of tutorials and youtube-lessons. I can't find a way of binding all that architecture together. Thanks.
Upvotes: 4
Views: 8758
Reputation: 29
First of all I wold like to tell you that if you want to use laravel Echo then currently it's only providing one way communication from server to client via sockets. whereas to send data from client to server these are using API's calls.
Now If you want to use simple sockets then I will recommend use ratchet package to use two way communication using ratchet library, here is the reference link: https://medium.com/@errohitdhiman/real-time-one-to-one-and-group-chat-with-php-laravel-ratchet-websocket-library-javascript-and-c64ba20621ed
Upvotes: 1
Reputation: 165
There are plenty of tutorials.
First understand why do you need to use a third party server for websockets (you don't have to but you want to).
Then:
A step by step guide to socket.io and Laravel
Upvotes: 0