<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -82,12 +82,26 @@ function joinChannel(app, cname) {
   // this is where we hang on the continuous _changes api
   // get the raw xhr
   refreshView(app, cname);
+  connectToChanges(app, cname, refreshView);
+};
+
+function changeXHR(app, cname, db_info, fun) {
+  var c_xhr = jQuery.ajaxSettings.xhr();
+  c_xhr.open(&quot;GET&quot;, app.db.uri+&quot;_changes?continuous=true&amp;since=&quot;+db_info.update_seq, true);
+  c_xhr.send(&quot;&quot;);
+  c_xhr.onreadystatechange = function() {
+    fun(app, cname);
+  };
+  return c_xhr;
+}
+
+function connectToChanges(app, cname, fun) {
   app.db.info({success: function(db_info) {
-    c_xhr = jQuery.ajaxSettings.xhr();
-    c_xhr.open(&quot;GET&quot;, app.db.uri+&quot;_changes?continuous=true&amp;since=&quot;+db_info.update_seq, true);
-    c_xhr.send(&quot;&quot;);
-    c_xhr.onreadystatechange = function() {
-      refreshView(app, cname);
-    };        
+    var x = changeXHR(app, cname, db_info, fun);
+    setInterval(function() {
+      x.abort();
+      x = changeXHR(app, cname, db_info, fun);
+    },1000 * 60);
   }});
-};
\ No newline at end of file
+}
+</diff>
      <filename>_attachments/app.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>45d599002f903497794f3b8d71bf77a1116ce020</id>
    </parent>
  </parents>
  <author>
    <name>Chris Anderson</name>
    <email>jchris@grabb.it</email>
  </author>
  <url>http://github.com/jchris/toast/commit/63d4b98be331832712ca499435b83aa053534611</url>
  <id>63d4b98be331832712ca499435b83aa053534611</id>
  <committed-date>2009-05-30T07:00:47-07:00</committed-date>
  <authored-date>2009-05-30T07:00:47-07:00</authored-date>
  <message>connect to changes refreshes the connection every minute</message>
  <tree>50b63c7b6fd9e2cab1911f0ef60e60123530ae20</tree>
  <committer>
    <name>Chris Anderson</name>
    <email>jchris@grabb.it</email>
  </committer>
</commit>
