Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websocket vs sse #323

Open
oakland opened this issue Nov 22, 2023 · 0 comments
Open

websocket vs sse #323

oakland opened this issue Nov 22, 2023 · 0 comments

Comments

@oakland
Copy link
Owner

oakland commented Nov 22, 2023

两者区别:

websocket 是客户端/服务端双向通讯,sse 是单向的,只能从服务端到客户端,客户端无法发送数据给服务端。

websocket 的数据延迟短,应该是后端自动确认的?sse 的发送频率是需要后端手动写死的,比如每隔一秒还是几秒,或者是后端判断数据发生变化的时候再发送,所以占用的带宽可以更少。

websocket 可以发送二进制数据和 utf-8 类型的数据,但是 sse 不能发送二进制数据,只能发送 utf-8 类型的数据。

sse 相比 websocket 而言更简单一些,值得替换。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant