Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
14 lines (8 sloc) 817 Bytes

phonegap-ratchet-demo

This is a demo that shows Ratchet working with (PhoneGap)[http://phonegap.com]. It's meant to be used with PhoneGap Build.

In order to get Ratchet to work with PhoneGap I had to make a small change to rachet.js. In that file replace:

if (xhr.readyState == 4) xhr.status == 200 ? success(xhr, options) : failure(options.url);

with

if (xhr.readyState == 4) xhr.status == 200 || (xhr.status == 0 && options.url.indexOf('file:///') != -1) ? success(xhr, options) : failure(options.url);

By also allowing for an XMLHttpRequest status of 0 when we're working with the filesystem, PhoneGap can work with push.js that Ratchet uses. (Thanks to @macdonst for the tip).