title: Simple form submission with Firebase; can I detect when offline?
body: <p>I'm using Firebase perhaps slightly unconventionally -for simple form submission. Submission of my website's contact form simply results in:</p>
  
  <pre><code>ref.push({name:'dr foo', email:'1@2.com', message:'bar'}, myCallback);
  </code></pre>
  
  <p>The Firebase is hooked up to Zapier to send the site owner an email. All works well, but I'd like to be able to handle the user loosing their connection. When Firebase can't reach the server I'd like to display: "Please check your connection", or a similar message when the user hits the send button. The "Thanks, we'll be in touch"-type message should only be displayed on a successful write.</p>
  
  <p>At first I tried including an <code>if (error)</code> branch in the callback, but of course disconnection is not something that Firebase considers an error as it "catches up" when it can. </p>
  
  <p>I also tried the <a href="https://www.firebase.com/docs/web/guide/offline-capabilities.html#section-connection-state" rel="nofollow">code in the docs</a> which monitors <code>.info/connected</code>. While this wouldn't display a message on a form submission attempt, I was thinking I could instead display a warning if disconnected. The sample worked intermittently (Chrome 39, Firefox 30, Linux Mint), but the lag between disconnection and the event firing means it's probably not suitable for this case. </p>
  
  <p>Is what I'm trying to do possible?</p>