Reputation: 999
I'm currently trying to develop a flutter app that connects to a laravel server using sockets.
I was following a tutorial, in which he used https://github.com/beyondcode/laravel-websockets and connected to Pusher and then from my mobile app I used Echo and Pusher Client.
To be honest I'm lost in the process, and can't really tell what's the purpose of each.
I would really appreciate if someone can help and explain the difference between Pusher, Websockets and Echo.
Thank you!
Upvotes: 0
Views: 6171
Reputation: 4091
Websockets are a communications protocol that provides a way for servers to deliver content to clients without the client needing to first make a request. Wikipedia describes them as:
The WebSocket protocol enables interaction between a web browser (or other client application) and a web server with lower overhead than half-duplex alternatives such as HTTP polling, facilitating real-time data transfer from and to the server. This is made possible by providing a standardized way for the server to send content to the client without being first requested by the client, and allowing messages to be passed back and forth while keeping the connection open. In this way, a two-way ongoing conversation can take place between the client and the server. The communications are usually done over TCP port number 443 (or 80 in the case of unsecured connections), which is beneficial for environments that block non-web Internet connections using a firewall. Similar two-way browser-server communications have been achieved in non-standardized ways using stopgap technologies such as Comet.
Pusher Channels is a hosted websocket solution that provides a simple, scalable websocket solution for developers - removing the need for developers to build, maintain and support websocket infrastructure. Their libraries also provide features such as HTTP fallbacks and automatic reconnection.
Laravel Echo is a library that can be used to integrate a Pusher Channels app into your Laravel app, along with supporting other websocket implementations
Beyondcode Laravel-Websockets is an open source websocket implementation to allow you to build your own websocket infrastructure.
Upvotes: 8