初识Http Push技术

以下基本抄自维基百科(词条:Push Technology)

Push技术

从交互模型上来说是一种publisher/subscriber机制,两者通过事件通知来发生关系

Http Push

HTTP server push (also known as HTTP streaming) is a mechanism for sending data from a web server to a web browser. HTTP server push can be achieved through several mechanisms.

Http Push的几种实现

Generally the web server does not terminate a connection after response data has been served to a client. The web server leaves the connection open such that if an event is received, it can immediately be sent to one or multiple clients.

服务端改http头

如:Non-Parsed Headers scripts on Apache

是否需要浏览器支持? 待研究

使用特殊的MIME类型

即“multipart/x-mixed-replace”

这种机制需要浏览器支持

Pushlet

The server never terminates the response, effectively fooling the browser into continuing in "loading" mode after the initial page load would normally be complete

这种机制不需要客户端支持,但在http超时后无法自动恢复

Long polling

With long polling, the client requests information from the server in a similar way to a normal poll. However, if the server does not have any information available for the client, instead of sending an empty response, the server holds the request and waits for some information to be available. commet就是这么玩的。

可以看出,这不是真正的server push.

Flash XMLSocket relays

待研究

BOSH

待研究

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.