Pusher vs Websocket vs Echo

Pusher vs Websocket vs Echo

我目前正在尝试开发一个使用套接字连接到 laravel 服务器的 flutter 应用程序。

我正在学习教程,其中他使用 https://github.com/beyondcode/laravel-websockets 并连接到 Pusher,然后我从我的移动应用程序使用 Echo 和 Pusher Client。

老实说,我迷失在这个过程中,无法真正说出每个的目的是什么。

如果有人可以帮助解释 Pusher、Websockets 和 Echo 之间的区别,我将不胜感激。

谢谢!

Websockets 是一种通信协议,它为服务器提供了一种向客户端传送内容的方式,而无需客户端先发出请求。 Wikipedia 将它们描述为:

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 是一个托管的 websocket 解决方案,它为开发人员提供了一个简单、可扩展的 websocket 解决方案——开发人员无需构建、维护和支持 websocket 基础设施。他们的库还提供 HTTP 回退和自动重新连接等功能。

Laravel Echo 是一个库,可用于将 Pusher Channels 应用集成到您的 Laravel 应用中,同时支持其他 websocket 实现

Beyondcode Laravel-Websockets 是一个开源的 websocket 实现,允许您构建自己的 websocket 基础设施。