comet: 服务器推模式通讯
采集日期:2008-4-26作者:E_wsq(注:本数据由系统自动采集,内容与BHCODE无关)
通过运行Pushlet的示例源代码(examples/basics/ push-js-stream.html),我们会看到这个每3秒刷新一次的页面。-- Hidden frame with the pushlet that pushes lines of JavaScript--> </FRAMESET> 可以看到push-js-stream.html中的push()函数被名为pushletFrame的JSP Frame调用:把传入的参数值写入到displayFrame(此Frame为push-js-stream-display.html)。<H1>WAIT...</H1> 这便是Pushlet的基本做法:我们从servlet(或者从示例中的JSP)把JavaScript代码作为HTTP流推送到浏览器。示例代码见examples/dhtml。