Morgan Cheng![]()
This module is Comet Client (http://en.wikipedia.org/wiki/Comet_(programming)) to support [http://ajaxpatterns.org/HTTP_Streaming HTTP Streaming].
After HTTP stream is connected to server, data can be pushed to browser from server through the HTTP connection in real time.
The module build stream channel to server with XmlHttpRequest for all browsers except IE, since [http://blogs.msdn.com/b/ieinternals/archive/2010/04/06/comet-streaming-in-internet-explorer-with-xmlhttprequest-and-xdomainrequest.aspx XmlHttpRequest in IE6 and IE7 is not suitable for XHR Streaming]. For IE browsers, [http://cometdaily.com/2007/11/05/the-forever-frame-technique/ Forever IFraming technique] is used to support streaming.
For non-IE browsers, the server is supposed to respond with chunked HTTP response. Since browser doesn't expose chunked structure to us, the format is actually chunked-in-chunked.
For IE browsers, the server is supposed to respond with "text/html" content.
...1K padding...
<script type="text/javascript">
parent.push("first message")
</script>
<script type="text/javascript">
parent.push("second message")
</script>
<script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2011.02.23-19-01'
}).use('gallery-comet-stream', function(Y) {
var streamUrl = "url-to-stream-source";
var streamClient = new Y.CometStream({
url: streamUrl,
on: {
pushed: function(data) {
// data is pushed message as string
}
}
});
streamClient.start();
});No forum posts for this module.
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info