An opinionated Comet client in Flash for Javascript
JavaScript ActionScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
bin-debug
html-template
libs
src
.actionScriptProperties
.flexProperties
.gitignore
.project
LICENSE
README

README

CometCatchr
===========

An opinionated Comet stream client in Flash to be used by Javascript.

You embed CometCatchr and specify a URL and a Javascript callback. It connects 
to the URL and listens for JSON data (expecting Transfer-Type: chunked). When 
it receives JSON, it parses it and passes it to you via your callback.

Using CometCatchr, you don't need to use complicated JS libraries and hacks 
for cross-browser, cross-domain Comet support. It also doesn't rely on long-
polling. It always uses a persistent socket connection.

Using CometCatcher
==================

Just embed it as you would any Flash, passing it these parameters:

 * url 		- Required. A URL to connect to.
 * callback - Required. A Javascript function to pass JSON to.
 * logger	- Optional. A function to pass log/debug data to.
 * retry	- Optional. Number of retries to attempt. Default: 3
 * policy	- Optional. Explicit location of cross-domain policy file
 
 Example using Firebug console for callback and logger:
 
 <embed src="bin-release/CometCatcher.swf?url=http://example.com/stream-provider&callback=console.log&logger=console.log" 
 	width="0" 
 	height="0" 
 	allowScriptAccess="sameDomain"
	type="application/x-shockwave-flash"
	pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>  

This example ignores the common use of <object> just to avoid redundancy.

Notes
=====

You need to host the SWF on the same domain as the HTML that embeds it. For 
local debugging, you need to run on localhost, not file:/// or it doesn't
work. It uses a Flash socket, so providing cross-domain policy is up to you.

Also, the server response this expects pretty much matches Twitter's
stream API exactly. If they had a crossdomain.xml file or policy socket
server, you could just point CometCatcher right at one of their stream 
endpoints, like: http://user:pass@stream.twitter.com/1/statuses/sample.json

Author
======

Jeff Lindsay <progrium@gmail.com>

License
=======

MIT