什么是“持久连接”意思? [英] What exactly does a "persistent connection" mean?

查看:261
本文介绍了什么是“持久连接”意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了关于 HTTP持续连接,但不知怎的,我似乎不明白

你能详细说明吗?

I read about "HTTP persistent connection" but somehow I don't seem to understand what does persistent mean in this context.
Could you'll elaborate?

推荐答案

现在已经从浏览器端的事情。浏览器首先请求实际页面,并解析页面并找出所需的所有其他资源,然后它才能呈现该页面。浏览器逐个请求这些资源和其他相关资源。因此,在这里维护持久连接是非常有效的,因为避免了创建和销毁连接的开销。

All the discussion till now has been from the browser side of things. The browser first request the actual page, and it parses the page and finds out all other resources that it needs before it can render that page. The browser requests these resources and other dependent resources one by one. So maintaining a persistent connection is very efficient here, as the overhead of creating and destroying connections is avoided.

现在从web服务器端的事情,持久连接将是一个允许它将内容推送到Web浏览器。现在HTTP不支持这个。所以,有几个解决方法与javascript的页面基本上刷新一段时间后。

Now from web server side of things, a persistent connection would be one that allows it to "push" content to the web browser. Now HTTP doesn't support this. So, there are few workarounds with javascript where the page is basically refreshed after a while.

您可以看到这是许多基于网络的电子邮件提供商使用的伎俩,它们不断地在后台检查新邮件。这给出当新电子邮件到达时的感觉,服务器将新的邮件通知推送到web浏览器。但实际上,它实际上是web浏览器,它一直在检查服务器的任何新邮件。

You can see this being trick being used by many web based email providers which continuously keep checking in the background for new mails. This gives a feeling that when a new mails arrives, the server "pushes" the new mail notification to the web browser. But in fact, its actually the web browser which keeps on checking the server for any new mail.

另外一点,我想说的是,看到任何页面刷新是因为另一个技巧,只允许页面的特定部分由请求刷新。 (HINT:AJAX)

Also another point that I would like to state is that we actually don't see any page refresh that's because of another trick which allows only specific parts of the page to be refreshed by the request. (HINT: AJAX)

这篇关于什么是“持久连接”意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆