为什么我们需要网络套接字?

编程入门 行业动态 更新时间:2024-10-24 16:25:03
本文介绍了为什么我们需要网络套接字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

这更像是一个 n00b 问题,但我从来没有真正知道答案.

This is more of a n00b question, but I've never really known the answer.

那为什么我们需要 websockets 协议?

so why do we need the websockets protocol?

以及,与彗星式/长轮询/挂起 GET 式 HTTP 使用相比,有哪些优势?

and, what are the advantages over comet-style/long poll/hanging GET-style use of HTTP?

推荐答案

Comet 和 Ajax 都可以提供终端用户体验,提供类似桌面的功能和低用户感知延迟,只有 Web Sockets 兑现了提供的承诺一种本地方式,以可忽略的延迟准确有效地将事件传入和传出浏览器.

Comet and Ajax can both deliver end-user experiences that provide desktop-like functionality and low user-perceived latency, only Web Sockets lives up to the promise of providing a native means to accurately and efficiently stream events to and from the browser with negligible latency.

通过轮询,它会发出不必要的请求,因此,在低消息速率的情况下,许多连接被不必要地打开和关闭.(与轮询一样,它会定期发送 HTTP 请求并立即收到响应.)

With polling it makes unnecessary requests and, as a result, many connections are opened and closed needlessly in low-message-rate situations.(as with polling it sends HTTP requests at regular intervals and immediately receives a response.)

Web Sockets 消除了开销并显着降低了复杂性.

Web Sockets remove the overhead and dramatically reduce complexity.

这篇关于为什么我们需要网络套接字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 05:41:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1130530.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:网络

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!