Getting "java.io.EOFException: JSON error" using clojure twitter-api

I wrote a simple simple clojure code that accesses the twitter api stream. My code essentially matches the example code described in twitter-api docs:

(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*))  

I follow tweets about a specific user and use oauth for authentication (not shown). When I start the initial filtering method and the connection is opened using twitter, everything works fine for the spell, but if the stream is inactive for bits (about 30 seconds), that is, no tweets about this particular user go down with the pike, the following error occurs:

#<EOFException java.io.EOFException: JSON error (end-of-file)>

-, . . clojure twitter-api, , , , .

+5
1

, . , , . json EOF, .

, . , , JSON .

(if-not (clojure.string/blank? %)
   (json/read-str % :key-fn keyword)
   {})
+3
source

All Articles