• Register
  • Log In
  • Home
  • Quick Start
    • Configurator
    • Download YUI 3
  • Documentation
    • User Guides
    • Examples
    • API Docs
    • Environments
    • Tutorials
  • Community
    • Gallery
    • Blog
    • Forums
    • YUI Theater
    • Calendar
  • Contribute
    • YUI on GitHub »
    • File a Ticket
    • View Tickets
    • Dashboard
  • Other Projects
    • Shifter »
    • Yogi »
    • YUI 2
    • YUI Doc »
    • YUI Test
    • YUI Website
    • YUI Compressor »
    • YUI Builder »
    • YUI PHP Loader
    • Grid Builder »
    • Skin Builder »
  • YUI
  • >
  • Community
  • >
  • Gallery

Gallery

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • Yogi Documentation
  • Shifter Documentation
  • Developer Guide
  • Module Setup

Tag Cloud

Context Navigation

    YUI Library is not responsible for bugs or support with this module. It is available as a free service. For support please contact the module owner with the provided links.

    Comet Stream (gallery-comet-stream) on cdn

    Last Updated: 02/24/11
    + 0 -

    Morgan Cheng

    YUI Contributor

    See 4 more by this user.

    Created: 02/14/11
    Last CDN Push: 02/23/11
    Build Tag: gallery-2011.02.23-19-01
    Project: YUI 3
    License: YUI BSD
    YUI Version: 3.3.0
    Free for use.

    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>

    • Tags:
    • stream
    • morgancheng
    • comet
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    Code Sample

    <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();
     
    });

    Forum Posts

    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