title: Getting "java.io.EOFException: JSON error" using the clojure twitter-api
body: <p>I've written some simple clojure code that accesses the twitter streaming api. My code is essentially the same as the example code described in the twitter-api docs:</p>
  
  <pre><code>(def ^:dynamic *custom-streaming-callback* 
    (AsyncStreamingCallback. (comp println #(:text %) json/read-json #(str %2)) 
                             (comp println response-return-everything)
                             exception-print))
  
  (defn start-filtering []
    (statuses-filter :params {:follow 12345}
                     :oauth-creds *creds*
                     :callbacks *custom-streaming-callback*))  
  </code></pre>
  
  <p>I'm following tweets about a specific user and using oauth for authentication (not shown). When I run the start-filtering method and a connection is opened with twitter everything works well for a spell, but if the stream is inactive for a bit (around 30 seconds), i.e. no tweets about this particular user are coming down the pike, the following error occurs:</p>
  
  <pre><code>#&lt;EOFException java.io.EOFException: JSON error (end-of-file)&gt;
  </code></pre>
  
  <p>I assumed from the twitter docs that when using a streaming connection, twitter keeps the stream open indefinitely. I must be making some incorrect assumptions. I'm currently diving into the clojure twitter-api code to see what's going on, but I thought more eyes would help me figure this out more quickly.</p>