是否有一个真正的服务器推送通过http? [英] Is there a real server push over http?

查看:186
本文介绍了是否有一个真正的服务器推送通过http?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有办法假货,轮询(或长轮询),但有什么办法让服务器接触浏览器推出的信息?

在服务器上,并根据不同的服务器上可以锁定它(Apache和IIS为例)不是轮询选项浪费资源。

好像很多网站都通过HTTP使用长轮询伪造服务器端推送机制。那岂不是只是最好有内置到浏览器中的真正推协议?

哪些选项是有是服务器友好推(假冒或其他)信息,以网页浏览器?


解决方案

  

我知道有办法假货,轮询(或长轮询),但有什么办法让服务器接触浏览器推出的信息?


的连接必须由客户端向服务器首先建立。有接触Web客户机没有一台服务器的方式。


  

在服务器上,并根据不同的服务器上可以锁定它(Apache和IIS为例)不是轮询选项浪费资源。


这是正确的。 频繁轮询是低效的,这也是我们正在向一个推动世界的持久连接的原因之一。的WebSockets将是这个最佳的解决方案。我对,托管实时WebSocket的解决办法而努力,我们已经看到了这种技术,通过社区带动一个巨大的摄取是相信这是最好的解决办法对资源和实时通信问题。


  

好像很多网站都通过HTTP使用长轮询伪造服务器端推送机制。那岂不是只是最好有内置到浏览器中的真正推协议?


是的,这就是为什么我们现在的WebSockets。 HTTP的解决方案,Web浏览器最终是一个黑客,不浏览器之间一致地工作(同样的方式)。


  

哪些选项是有是服务器友好推(假冒或其他)信息,以网页浏览器?



  • HTTP长轮询:连接保持打开,直到该服务器有新的信息。的注意:这是标准的投票,其中新的信息请求可以是时间的完整赤身不同

  • HTTP流:这可能是你正在寻找(回答问题HTTP)的解决方案。使用这种技术的连接保持打开和信息的新作品可以推在现有的连接,从服务器到客户端,无需连接被关闭并重新打开,因为它是使用HTTP长轮询。

  • HTTP / 2服务器推送:从服务器推送到客户端的另一个标准化机制。这些被称为推响应,浏览器会缓存这些。

  • 的WebSockets :全通过网络浏览器中的单个TCP连接(或任何Web客户端)双向全双工通信

相关信息和资源:


  1. 您能想到的服务器发送事件(的EventSource API )作为标准化HTTP的长轮询和HTTP流式的。

  2. HTTP / 2服务器推送

I know there are ways to fake it, polling (or long polling) but is there any way to have the server contact the browser to push out information?

Either polling option wastes resources on the server and depending on the server can lock it up (apache and iis for example).

Seems like a lot of sites are using long polling to fake a server-side push mechanism over http. Wouldn't it just be better to have a true push protocol built into a browser?

What options are there that are server friendly to push (fake or otherwise) information to web browsers?

解决方案

I know there are ways to fake it, polling (or long polling) but is there any way to have the server contact the browser to push out information?

The connection must be first established by the client to the server. There's no way of a server contacting a web client.

Either polling option wastes resources on the server and depending on the server can lock it up (apache and iis for example).

That's correct. Frequent polling is inefficient which is one of the reasons we are moving to a push world with persistent connections. WebSockets will be the best solution for this. I work for Pusher, a hosted realtime WebSocket solution, and we've seen a massive uptake in this technology driven by a community that believe it's the best solution to the resource and realtime communication problem.

Seems like a lot of sites are using long polling to fake a server-side push mechanism over http. Wouldn't it just be better to have a true push protocol built into a browser?

Yes, that's why we now have WebSockets. HTTP solutions to web browsers are ultimately a hack and don't work consistently (in the same way) between browsers.

What options are there that are server friendly to push (fake or otherwise) information to web browsers?

  • HTTP Long-Polling: The connection is held open until the server has new information. Note: this is different to standard polling where requests for new information can be a complete wast of time.
  • HTTP Streaming: This is probably the solution you are looking for (answering the HTTP question). Using this technique the connection is held open and new pieces of information can be pushed over that existing connection, from server to client, without the connection being closed and re-opened as it is with HTTP Long-Polling.
  • HTTP/2 Server Push: Another standardised mechanism for pushing from server to client. These are known as "pushed responses" and the browser may cache these.
  • WebSockets: Full bi-directional and full duplex communication over a single TCP connection within a web browser (or any web client).

Related information and resources:

  1. You can think Server-Sent Events (the EventSource API) as a standardisation of of HTTP Long-Polling and HTTP-Streaming.
  2. HTTP/2 Server Push

这篇关于是否有一个真正的服务器推送通过http?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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